当前位置: 首页>>代码示例>>Java>>正文


Java OrientationHelper.VERTICAL属性代码示例

本文整理汇总了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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:MDGridRvDividerDecoration.java

示例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;
}
 
开发者ID:wayfair,项目名称:brickkit-android,代码行数:16,代码来源:BrickFragment.java

示例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");
    }
}
 
开发者ID:dkzwm,项目名称:ItemDecorations,代码行数:16,代码来源:BaseItemDecoration.java

示例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;
}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:16,代码来源:FlyoutFragment.java

示例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();
}
 
开发者ID:nfdz,项目名称:foco,代码行数:16,代码来源:MusicDialog.java

示例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);
        }
    });
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:20,代码来源:HomeActivity.java

示例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;
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:DividerDecoration.java

示例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));
}
 
开发者ID:dbof10,项目名称:redux-observable,代码行数:10,代码来源:HomeActivity.java

示例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();
}
 
开发者ID:charbgr,项目名称:litho-picasso,代码行数:15,代码来源:DemoListComponentSpec.java

示例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();
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:15,代码来源:UIDivider.java

示例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;
}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:10,代码来源:CategorySelectorFragment.java

示例12: BounceRecyclerView

public BounceRecyclerView(Context context, AttributeSet attrs) {
  super(context, attrs, OrientationHelper.VERTICAL);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:3,代码来源:BounceRecyclerView.java

示例13: initData

private void initData() {
    // 竖直方向的网格样式,每行四个Item
    mLayoutManager = new GridLayoutManager(this, 4, OrientationHelper.VERTICAL, false);

    mAdapter = new MDRvAdapter(MDMockData.getRvData());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:MDGridRvActivity.java

示例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);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:42,代码来源:MDGridRvDividerDecoration.java

示例15: isVertical

boolean isVertical(){
    return mOrientation==OrientationHelper.VERTICAL;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:3,代码来源:BaseBounceView.java


注:本文中的android.support.v7.widget.OrientationHelper.VERTICAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。