本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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;
}