當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。