androidx.recyclerview.widget.RecyclerView#Orientation ( )源码实例Demo

下面列出了androidx.recyclerview.widget.RecyclerView#Orientation ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * 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();
    }
}
 
源代码2 项目: MaterialDateTimePicker   文件: DayPickerView.java
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);
}
 
源代码3 项目: RecyclerViewExtensions   文件: DemoActivity.java
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);
}
 
源代码4 项目: CommonUtils   文件: RecyclerMessageView.java
public void linearLayoutManager(@RecyclerView.Orientation int orientation, boolean reversed) {
    list.setLayoutManager(new LinearLayoutManager(list.getContext(), orientation, reversed));
}
 
源代码5 项目: CommonUtils   文件: RecyclerMessageView.java
public void dividerDecoration(@RecyclerView.Orientation int orientation) {
    list.addItemDecoration(new DividerItemDecoration(list.getContext(), orientation));
}
 
源代码6 项目: AndroidProject   文件: PickerLayoutManager.java
/**
 * 设置布局摆放器方向
 */
public Builder setOrientation(@RecyclerView.Orientation int orientation) {
    mOrientation = orientation;
    return this;
}
 
public StickyHeadersLinearLayoutManager(
        Context context, @RecyclerView.Orientation int orientation, boolean reverseLayout) {
    super(context, orientation, reverseLayout);
}