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


Java StaggeredGridLayoutManager.getOrientation方法代码示例

本文整理汇总了Java中android.support.v7.widget.StaggeredGridLayoutManager.getOrientation方法的典型用法代码示例。如果您正苦于以下问题:Java StaggeredGridLayoutManager.getOrientation方法的具体用法?Java StaggeredGridLayoutManager.getOrientation怎么用?Java StaggeredGridLayoutManager.getOrientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.widget.StaggeredGridLayoutManager的用法示例。


在下文中一共展示了StaggeredGridLayoutManager.getOrientation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isLastColum

import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
private boolean isLastColum(RecyclerView parent, int pos, int spanCount,
                            int childCount) {
    LayoutManager layoutManager = parent.getLayoutManager();
    if (layoutManager instanceof GridLayoutManager) {
        if ((pos + 1) % spanCount == 0)// 如果是最后一列,则不需要绘制右边
        {
            return true;
        }
    } else if (layoutManager instanceof StaggeredGridLayoutManager) {
        StaggeredGridLayoutManager manager = ((StaggeredGridLayoutManager) layoutManager);
        if (manager.getOrientation() == StaggeredGridLayoutManager.VERTICAL) {
            View view = parent.getChildAt(pos);
            if (view != null && ((StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams())
                    .getSpanIndex() == ((StaggeredGridLayoutManager) layoutManager).getSpanCount()) {
                // 如果是最后一列,则不需要绘制右边
                return true;
            }
        } else {
            childCount = childCount - childCount % spanCount;
            if (pos >= childCount)// 如果是最后一列,则不需要绘制右边
                return true;
        }
    }
    return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:DividerGridItemDecoration.java

示例2: isHorizontalView

import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
private static boolean isHorizontalView(View view) {
    if (view instanceof ViewPager || view instanceof HorizontalScrollView
            || view instanceof WebView) {
        return true;
    }
    try {
        if (view instanceof RecyclerView) {
            RecyclerView recyclerView = (RecyclerView) view;
            RecyclerView.LayoutManager manager = recyclerView.getLayoutManager();
            if (manager != null) {
                if (manager instanceof LinearLayoutManager) {
                    LinearLayoutManager linearManager = ((LinearLayoutManager) manager);
                    if (linearManager.getOrientation() == LinearLayoutManager.HORIZONTAL)
                        return true;
                } else if (manager instanceof StaggeredGridLayoutManager) {
                    StaggeredGridLayoutManager gridLayoutManager = (StaggeredGridLayoutManager) manager;
                    if (gridLayoutManager.getOrientation() == StaggeredGridLayoutManager.HORIZONTAL)
                        return true;
                }
            }
        }
    } catch (NoClassDefFoundError e) {
        e.printStackTrace();
    }
    return false;
}
 
开发者ID:dkzwm,项目名称:SmoothRefreshLayout,代码行数:27,代码来源:BoundaryUtil.java

示例3: setLayoutManager

import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
public void setLayoutManager(LayoutManager layout) {
    super.setLayoutManager(layout);
    canpull = true;
    if (layout instanceof LinearLayoutManager) {
        linearLayoutManager = (LinearLayoutManager) layout;
        if (linearLayoutManager.getOrientation() != VERTICAL)
            canpull = false;
    } else if (layout instanceof GridLayoutManager) {
        gridLayoutManager = (GridLayoutManager) layout;
        if (gridLayoutManager.getOrientation() != VERTICAL)
            canpull = false;
    } else if (layout instanceof StaggeredGridLayoutManager) {
        staggeredGridLayoutManager = (StaggeredGridLayoutManager) layout;
        if (staggeredGridLayoutManager.getOrientation() != VERTICAL)
            canpull = false;
    }
}
 
开发者ID:While1true,项目名称:JSSample,代码行数:19,代码来源:SRecyclerView.java

示例4: isVerticalView

import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
private static boolean isVerticalView(View view) {
    if (view instanceof AbsListView || view instanceof ScrollView
            || view instanceof NestedScrollView
            || view instanceof WebView) {
        return true;
    }
    try {
        if (view instanceof RecyclerView) {
            RecyclerView recyclerView = (RecyclerView) view;
            RecyclerView.LayoutManager manager = recyclerView.getLayoutManager();
            if (manager != null) {
                if (manager instanceof LinearLayoutManager) {
                    LinearLayoutManager linearManager = ((LinearLayoutManager) manager);
                    if (linearManager.getOrientation() == LinearLayoutManager.VERTICAL)
                        return true;
                } else if (manager instanceof StaggeredGridLayoutManager) {
                    StaggeredGridLayoutManager gridLayoutManager = (StaggeredGridLayoutManager) manager;
                    if (gridLayoutManager.getOrientation() == StaggeredGridLayoutManager.VERTICAL)
                        return true;
                }
            }
        }
    } catch (NoClassDefFoundError e) {
        e.printStackTrace();
    }
    return false;
}
 
开发者ID:dkzwm,项目名称:SmoothRefreshLayout,代码行数:28,代码来源:HorizontalBoundaryUtil.java


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