Java Code Examples for android.support.v7.widget.RecyclerView#setVerticalScrollBarEnabled()
The following examples show how to use
android.support.v7.widget.RecyclerView#setVerticalScrollBarEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuickReplyListView.java From imsdk-android with MIT License | 6 votes |
private RecyclerView getListView(final List<String> quickReplies, final OnQuickRepliesClickListener listener) { RecyclerView recyclerView = new RecyclerView(context); recyclerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); recyclerView.setLayoutManager(new LinearLayoutManager(context)); recyclerView.setVerticalScrollBarEnabled(false); recyclerView.setHorizontalScrollBarEnabled(false); recyclerView.setBackgroundColor(Color.TRANSPARENT); QuickReplyAdapter quickReplyAdapter = new QuickReplyAdapter(R.layout.atom_ui_quickreply_item, quickReplies); quickReplyAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() { @Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { listener.onQuickReplyClick(quickReplies.get(position)); } }); recyclerView.setAdapter(quickReplyAdapter); return recyclerView; }
Example 2
Source File: PathLayoutManager.java From PathLayoutManager with Apache License 2.0 | 6 votes |
/** * 通过反射替换默认的Item动画 (解决在某些机型上的crash问题) */ private void initItemAnimator() { try { Field field = RecyclerView.LayoutManager.class.getDeclaredField("mRecyclerView"); field.setAccessible(true); RecyclerView recyclerView = (RecyclerView) field.get(this); if (recyclerView != null) { recyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER); recyclerView.setHorizontalScrollBarEnabled(false); recyclerView.setVerticalScrollBarEnabled(false); if (recyclerView.getItemAnimator() != mItemAnimator) { recyclerView.setItemAnimator(mItemAnimator); } } // recyclerView.setItemAnimator(null); mRecycler.setViewCacheSize(mCacheCount); } catch (Exception e) { e.printStackTrace(); } }
Example 3
Source File: MainActivity.java From FlexibleSearchBar with Apache License 2.0 | 6 votes |
private void initView() { ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.hide(); } searchbarview = (SearchBarView) findViewById(R.id.searchbarview); searchbarview.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // enter search activity Toast.makeText(MainActivity.this, "enter search activity", Toast.LENGTH_SHORT).show(); } }); AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appbarlayout); appBarLayout.addOnOffsetChangedListener(this); toolbar = (Toolbar) findViewById(R.id.toolbar); RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.recyclerview); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.setVerticalScrollBarEnabled(true); mRecyclerView.setNestedScrollingEnabled(false); mRecyclerView.setAdapter(new MyAdapter()); }
Example 4
Source File: RecyclerViewBehavior.java From timecat with Apache License 2.0 | 5 votes |
@Override public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, RecyclerView child, View target, int dx, int dy, int[] consumed) { // Log.e("ldf", "onNestedPreScroll"); super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed); child.setVerticalScrollBarEnabled(true); MonthPager monthPager = (MonthPager) coordinatorLayout.getChildAt(0); if (monthPager.getPageScrollState() != ViewPager.SCROLL_STATE_IDLE) { consumed[1] = dy; Log.w("ldf", "onNestedPreScroll: MonthPager dragging"); Toast.makeText(context, "loading month data", Toast.LENGTH_SHORT).show(); return; } // 上滑,正在隐藏顶部的日历 hidingTop = dy > 0 && child.getTop() <= initOffset && child.getTop() > getMonthPager(coordinatorLayout).getCellHeight(); // 下滑,正在展示顶部的日历 showingTop = dy < 0 && !ViewCompat.canScrollVertically(target, -1); if (hidingTop || showingTop) { consumed[1] = Utils.scroll(child, dy, getMonthPager(coordinatorLayout).getCellHeight(), getMonthPager(coordinatorLayout).getViewHeight()); saveTop(child.getTop()); } }
Example 5
Source File: IndexStickyView.java From IndexStickyView with Apache License 2.0 | 5 votes |
/** * 初始化数据列表视图 * @param context */ private void initRecyclerView(Context context) { mLinearLayoutManager = new LinearLayoutManager(context); mRecyclerView = new RecyclerView(context); mRecyclerView.setVerticalScrollBarEnabled(false); mRecyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER); mRecyclerView.setLayoutManager(mLinearLayoutManager); mRecyclerView.addOnScrollListener(new RecyclerViewScrollListener()); LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); addView(mRecyclerView, layoutParams); }
Example 6
Source File: IndexableLayout.java From IndexableRecyclerView with Apache License 2.0 | 5 votes |
private void init(Context context, AttributeSet attrs) { this.mContext = context; this.mExecutorService = Executors.newSingleThreadExecutor(); PADDING_RIGHT_OVERLAY = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 80, getResources().getDisplayMetrics()); if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.IndexableRecyclerView); mBarTextColor = a.getColor(R.styleable.IndexableRecyclerView_indexBar_textColor, ContextCompat.getColor(context, R.color.default_indexBar_textColor)); mBarTextSize = a.getDimension(R.styleable.IndexableRecyclerView_indexBar_textSize, getResources().getDimension(R.dimen.default_indexBar_textSize)); mBarFocusTextColor = a.getColor(R.styleable.IndexableRecyclerView_indexBar_selectedTextColor, ContextCompat.getColor(context, R.color.default_indexBar_selectedTextColor)); mBarTextSpace = a.getDimension(R.styleable.IndexableRecyclerView_indexBar_textSpace, getResources().getDimension(R.dimen.default_indexBar_textSpace)); mBarBg = a.getDrawable(R.styleable.IndexableRecyclerView_indexBar_background); mBarWidth = a.getDimension(R.styleable.IndexableRecyclerView_indexBar_layout_width, getResources().getDimension(R.dimen.default_indexBar_layout_width)); a.recycle(); } if (mContext instanceof Activity) { ((Activity) mContext).getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); } mRecy = new RecyclerView(context); mRecy.setVerticalScrollBarEnabled(false); mRecy.setOverScrollMode(View.OVER_SCROLL_NEVER); addView(mRecy, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); mIndexBar = new IndexBar(context); mIndexBar.init(mBarBg, mBarTextColor, mBarFocusTextColor, mBarTextSize, mBarTextSpace); LayoutParams params = new LayoutParams((int) mBarWidth, LayoutParams.WRAP_CONTENT); params.gravity = Gravity.END | Gravity.CENTER_VERTICAL; addView(mIndexBar, params); mRealAdapter = new RealAdapter(); mRecy.setHasFixedSize(true); mRecy.setAdapter(mRealAdapter); initListener(); }
Example 7
Source File: DisplayListFragment.java From actor-platform with GNU Affero General Public License v3.0 | 5 votes |
protected void configureRecyclerView(RecyclerView recyclerView) { recyclerView.setHasFixedSize(true); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity()); linearLayoutManager.setRecycleChildrenOnDetach(false); linearLayoutManager.setSmoothScrollbarEnabled(false); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setHorizontalScrollBarEnabled(false); recyclerView.setVerticalScrollBarEnabled(true); }