Java Code Examples for androidx.recyclerview.widget.RecyclerView#Orientation
The following examples show how to use
androidx.recyclerview.widget.RecyclerView#Orientation .
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: SelectiveDividerItemDecoration.java From CommonUtils with Apache License 2.0 | 5 votes |
/** * Creates a divider {@link RecyclerView.ItemDecoration} that can be used with a * {@link LinearLayoutManager}. * * @param context Current context, it will be used to access resources. * @param orientation Divider orientation. Should be {@link RecyclerView#HORIZONTAL} or {@link RecyclerView#VERTICAL}. */ public SelectiveDividerItemDecoration(@NonNull Context context, @RecyclerView.Orientation int orientation, @NonNull Collection<Integer> positions) { this.positions = positions; this.mOrientation = orientation; final TypedArray a = context.obtainStyledAttributes(ATTRS); try { this.mDivider = a.getDrawable(0); } finally { a.recycle(); } }
Example 2
Source File: DayPickerView.java From MaterialDateTimePicker with Apache License 2.0 | 5 votes |
public void init(Context context, DatePickerDialog.ScrollOrientation scrollOrientation) { @RecyclerView.Orientation int layoutOrientation = scrollOrientation == DatePickerDialog.ScrollOrientation.VERTICAL ? RecyclerView.VERTICAL : RecyclerView.HORIZONTAL; LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context, layoutOrientation, false); setLayoutManager(linearLayoutManager); setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); setVerticalScrollBarEnabled(false); setHorizontalScrollBarEnabled(false); setClipChildren(false); mContext = context; setUpRecyclerView(scrollOrientation); }
Example 3
Source File: DemoActivity.java From RecyclerViewExtensions with MIT License | 5 votes |
public void setLayout(int layout) { @RecyclerView.Orientation int orientation; boolean reverse; switch (layout % 4) { case 0: orientation = LinearLayoutManager.VERTICAL; reverse = false; break; case 1: orientation = LinearLayoutManager.VERTICAL; reverse = true; break; case 3: orientation = LinearLayoutManager.HORIZONTAL; reverse = true; break; default: orientation = LinearLayoutManager.HORIZONTAL; reverse = false; break; } mAdapter = new DemoAdapter(orientation); mAdapter.setDataset(getAdapterItems()); if (mSelector != null) { mAdapter.setSelector(mSelector); } mAdapter.setDragDropHelper(mDragDropHelper); mRecyclerView.setLayoutManager(new StickyHeadersLinearLayoutManager(this, orientation, reverse)); mProgressEmptyRecyclerFlipper.monitor(mAdapter); mRecyclerView.setAdapter(mAdapter); mDragDropHelper.attach(mRecyclerView, mAdapter); }
Example 4
Source File: RecyclerMessageView.java From CommonUtils with Apache License 2.0 | 4 votes |
public void linearLayoutManager(@RecyclerView.Orientation int orientation, boolean reversed) { list.setLayoutManager(new LinearLayoutManager(list.getContext(), orientation, reversed)); }
Example 5
Source File: RecyclerMessageView.java From CommonUtils with Apache License 2.0 | 4 votes |
public void dividerDecoration(@RecyclerView.Orientation int orientation) { list.addItemDecoration(new DividerItemDecoration(list.getContext(), orientation)); }
Example 6
Source File: PickerLayoutManager.java From AndroidProject with Apache License 2.0 | 4 votes |
/** * 设置布局摆放器方向 */ public Builder setOrientation(@RecyclerView.Orientation int orientation) { mOrientation = orientation; return this; }
Example 7
Source File: StickyHeadersLinearLayoutManager.java From RecyclerViewExtensions with MIT License | 4 votes |
public StickyHeadersLinearLayoutManager( Context context, @RecyclerView.Orientation int orientation, boolean reverseLayout) { super(context, orientation, reverseLayout); }