本文整理匯總了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;
}