本文整理汇总了Java中android.support.v7.widget.OrientationHelper.VERTICAL属性的典型用法代码示例。如果您正苦于以下问题:Java OrientationHelper.VERTICAL属性的具体用法?Java OrientationHelper.VERTICAL怎么用?Java OrientationHelper.VERTICAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.support.v7.widget.OrientationHelper
的用法示例。
在下文中一共展示了OrientationHelper.VERTICAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getItemOffsets
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int spanCount = ((GridLayoutManager) parent.getLayoutManager()).getSpanCount();
int orientation = ((GridLayoutManager)parent.getLayoutManager()).getOrientation();
int position = parent.getChildLayoutPosition(view);
if(orientation == OrientationHelper.VERTICAL && (position + 1) % spanCount == 0) {
outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
return;
}
if(orientation == OrientationHelper.HORIZONTAL && (position + 1) % spanCount == 0) {
outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
return;
}
outRect.set(0, 0, mDivider.getIntrinsicWidth(), mDivider.getIntrinsicHeight());
}
示例2: onCreateView
@Override
@CallSuper
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view;
if (orientation() == OrientationHelper.VERTICAL) {
view = inflater.inflate(R.layout.vertical_fragment_brick, container, false);
} else {
view = inflater.inflate(R.layout.horizontal_fragment_brick, container, false);
}
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
recyclerView.setBackgroundColor(recyclerViewBackground);
((DefaultItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
dataManager.setRecyclerView(getContext(), recyclerView, orientation(), reverse(), view);
return view;
}
示例3: draw
private void draw(Canvas c, RecyclerView parent) {
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
if ((layoutManager instanceof LinearLayoutManager)) {
LinearLayoutManager manager = (LinearLayoutManager) layoutManager;
if (manager.getOrientation() == OrientationHelper.VERTICAL)
drawVerticalOrientationDividers(c, parent, manager);
else
drawHorizontalOrientationDividers(c, parent, manager);
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
Log.e(getClass().getSimpleName(), "Will soon support this feature !!");
} else {
throw new UnsupportedOperationException(getClass().getSimpleName() +
" can only be used in the RecyclerView which use GridLayoutManager" +
" or LinearLayoutManager or StaggeredGridLayoutManager");
}
}
示例4: onCreateView
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Read configuration, preferring the saved values over the inflated values
readArgumentsFromBundle(getArguments());
readArgumentsFromBundle(savedInstanceState);
int layout = mScrollOrientation == OrientationHelper.VERTICAL
? R.layout.default_flyout_start : R.layout.default_flyout_bottom;
mFlyoutView = inflater.inflate(layout, null);
RecyclerView recyclerView = (RecyclerView) mFlyoutView.findViewById(R.id.block_list_view);
mRecyclerHelper = new BlockRecyclerViewHelper(recyclerView, getContext());
mRecyclerHelper.setScrollOrientation(mScrollOrientation);
return mFlyoutView;
}
示例5: onViewCreated
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
int orientation = OrientationHelper.VERTICAL;
boolean reverseLayout = false;
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), orientation, reverseLayout);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setHasFixedSize(true);
mAdapter = new SongsAdapter();
mRecyclerView.setAdapter(mAdapter);
// hide whole interface until the fragment is connected with the service
hideContent();
}
示例6: initLaunchpad
private void initLaunchpad() {
mLauncherView.setHasFixedSize(true);
StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(3, OrientationHelper.VERTICAL);
mLauncherView.setLayoutManager(layoutManager);
mLaunchpadAdapter = new LaunchpadAdapter(this);
SmartRecyclerAdapter wrap = new SmartRecyclerAdapter(mLaunchpadAdapter);
View footer = new View(this);
footer.setLayoutParams(new StaggeredGridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, VUiKit.dpToPx(this, 60)));
wrap.setFooterView(footer);
mLauncherView.setAdapter(wrap);
mLauncherView.addItemDecoration(new ItemOffsetDecoration(this, R.dimen.desktop_divider));
ItemTouchHelper touchHelper = new ItemTouchHelper(new LauncherTouchCallback());
touchHelper.attachToRecyclerView(mLauncherView);
mLaunchpadAdapter.setAppClickListener((pos, data) -> {
if (!data.isLoading()) {
mLaunchpadAdapter.notifyItemChanged(pos);
mPresenter.launchApp(data);
}
});
}
示例7: getItemOffsets
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int position = parent.getChildAdapterPosition(view);
int orientation = 0;
int headerCount = 0,footerCount = 0;
if (parent.getAdapter() instanceof RecyclerArrayAdapter){
headerCount = ((RecyclerArrayAdapter) parent.getAdapter()).getHeaderCount();
footerCount = ((RecyclerArrayAdapter) parent.getAdapter()).getFooterCount();
}
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
if (layoutManager instanceof StaggeredGridLayoutManager){
orientation = ((StaggeredGridLayoutManager) layoutManager).getOrientation();
}else if (layoutManager instanceof GridLayoutManager){
orientation = ((GridLayoutManager) layoutManager).getOrientation();
}else if (layoutManager instanceof LinearLayoutManager){
orientation = ((LinearLayoutManager) layoutManager).getOrientation();
}
if (position>=headerCount&&position<parent.getAdapter().getItemCount()-footerCount||mDrawHeaderFooter){
if (orientation == OrientationHelper.VERTICAL){
outRect.bottom = mHeight;
}else {
outRect.right = mHeight;
}
}
}
示例8: onCreate
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_repos);
bindViews(this);
componentContext = new ComponentContext(this);
recyclerBinder = new RecyclerBinder(
componentContext, 4.0f, new LinearLayoutInfo(this, OrientationHelper.VERTICAL, false));
sRefresh.setOnRefreshListener(() -> store.dispatch(HomeAction.REFRESH));
}
示例9: onCreateLayout
@OnCreateLayout
static ComponentLayout onCreateLayout(ComponentContext c) {
final RecyclerBinder recyclerBinder = new RecyclerBinder(
c,
4.0f,
new LinearLayoutInfo(c, OrientationHelper.VERTICAL, false));
Demos.addAllToBinder(recyclerBinder, c);
return Recycler.create(c)
.binder(recyclerBinder)
.withLayout().flexShrink(0)
.testKey(MAIN_SCREEN)
.build();
}
示例10: UIDivider
public UIDivider(Context context, int orientation, int dividerColor, Drawable dividerDrawable,
int dividerWidth,int marginLeft,int marginRight) {
if (orientation != OrientationHelper.HORIZONTAL && orientation !=OrientationHelper.VERTICAL){
throw new IllegalArgumentException("分割线 方向出错");
}
if (dividerWidth <0)
throw new IllegalArgumentException("分割线 尺寸出错");
mOrientation = orientation;
mDividerColor = dividerColor;
mDividerDrawable = dividerDrawable;
mDividerWidth = dividerWidth;
mMarginLeft = marginLeft;
mMarginRight = marginRight;
initPaint();
}
示例11: onCreateView
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
int layout = mScrollOrientation == OrientationHelper.VERTICAL
? R.layout.default_category_start : R.layout.default_category_horizontal;
mCategoryView = (CategoryView) inflater.inflate(layout, null);
mCategoryView.setLabelRotation(mLabelRotation);
mCategoryView.setScrollOrientation(mScrollOrientation);
return mCategoryView;
}
示例12: BounceRecyclerView
public BounceRecyclerView(Context context, AttributeSet attrs) {
super(context, attrs, OrientationHelper.VERTICAL);
}
示例13: initData
private void initData() {
// 竖直方向的网格样式,每行四个Item
mLayoutManager = new GridLayoutManager(this, 4, OrientationHelper.VERTICAL, false);
mAdapter = new MDRvAdapter(MDMockData.getRvData());
}
示例14: onDraw
@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
// 绘制间隔,每一个item,绘制右边和下方间隔样式
int childCount = parent.getChildCount();
int spanCount = ((GridLayoutManager)parent.getLayoutManager()).getSpanCount();
int orientation = ((GridLayoutManager)parent.getLayoutManager()).getOrientation();
boolean isDrawHorizontalDivider = true;
boolean isDrawVerticalDivider = true;
int extra = childCount % spanCount;
extra = extra == 0 ? spanCount : extra;
for(int i = 0; i < childCount; i++) {
isDrawVerticalDivider = true;
isDrawHorizontalDivider = true;
// 如果是竖直方向,最右边一列不绘制竖直方向的间隔
if(orientation == OrientationHelper.VERTICAL && (i + 1) % spanCount == 0) {
isDrawVerticalDivider = false;
}
// 如果是竖直方向,最后一行不绘制水平方向间隔
if(orientation == OrientationHelper.VERTICAL && i >= childCount - extra) {
isDrawHorizontalDivider = false;
}
// 如果是水平方向,最下面一行不绘制水平方向的间隔
if(orientation == OrientationHelper.HORIZONTAL && (i + 1) % spanCount == 0) {
isDrawHorizontalDivider = false;
}
// 如果是水平方向,最后一列不绘制竖直方向间隔
if(orientation == OrientationHelper.HORIZONTAL && i >= childCount - extra) {
isDrawVerticalDivider = false;
}
if(isDrawHorizontalDivider) {
drawHorizontalDivider(c, parent, i);
}
if(isDrawVerticalDivider) {
drawVerticalDivider(c, parent, i);
}
}
}
示例15: isVertical
boolean isVertical(){
return mOrientation==OrientationHelper.VERTICAL;
}