本文整理汇总了Java中android.support.v7.widget.StaggeredGridLayoutManager.VERTICAL属性的典型用法代码示例。如果您正苦于以下问题:Java StaggeredGridLayoutManager.VERTICAL属性的具体用法?Java StaggeredGridLayoutManager.VERTICAL怎么用?Java StaggeredGridLayoutManager.VERTICAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.support.v7.widget.StaggeredGridLayoutManager
的用法示例。
在下文中一共展示了StaggeredGridLayoutManager.VERTICAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View views = inflater.inflate(R.layout.fragment_base_view, container, false);
unbinder = ButterKnife.bind(this,views);
progressLayout.showLoading();
swipeRefreshLayout.setOnRefreshListener(this);
recyclerView.setHasFixedSize(true); //originally set to fixed size true
mLayoutManager = new StaggeredGridLayoutManager(getResources().getInteger(R.integer.card_col_size_home), StaggeredGridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(mLayoutManager);
if(savedInstanceState != null) {
model_user = savedInstanceState.getString(MODEL_USER);
model_type = savedInstanceState.getString(MODEL_TYPE);
}
return views;
}
示例2: onInit
private void onInit() {
mCurrentUser = mPresenter.getCurrentUser();
loaderManager = getLoaderManager();
swipeRefreshLayout.setOnRefreshListener(this);
recyclerView.setHasFixedSize(true); //originally set to fixed size true
recyclerView.setNestedScrollingEnabled(false); //set to false if somethings fail to work properly
mLayoutManager = new StaggeredGridLayoutManager(getResources().getInteger(R.integer.card_col_size_home), StaggeredGridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(mLayoutManager);
mActivityOrigin.setHasFixedSize(true);
mActivityOrigin.setNestedScrollingEnabled(false);
View bottomSheet = new BottomSheetBuilder(this, coordinatorLayout)
.setMode(BottomSheetBuilder.MODE_GRID)
.setBackgroundColorResource(R.color.colorDarkKnight)
.setItemTextColorResource(R.color.white)
.setMenu(R.menu.menu_attachments)
.setItemClickListener(this).createView();
mBehavior = BottomSheetBehavior.from(bottomSheet);
mBehavior.setBottomSheetCallback(null);
updateUI();
}
示例3: isLastRow
private boolean isLastRow(RecyclerView parent, int pos, int rowCount, int childCount) {
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
if (layoutManager instanceof GridLayoutManager) {
childCount = childCount - childCount % rowCount;
if (pos >= childCount) { // 如果是最后一行,则不需要绘制底部分割线
return true;
}
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
int orientation = ((StaggeredGridLayoutManager) layoutManager).getOrientation();
if (orientation == StaggeredGridLayoutManager.VERTICAL) {
childCount = childCount - childCount % rowCount;
if (pos >= childCount) { // 如果是最后一行,则不需要绘制底部分割线
return true;
}
} else {
if ((pos + 1) % rowCount == 0) { // 如果是最后一行,则不需要绘制底部分割线
return true;
}
}
}
return false;
}
示例4: initView
@Override
public void initView(Bundle savedInstanceState) {
getBinding().setFrag(this);
getBinding().swipeRefreshGirl.setColorSchemeColors(Color.parseColor("#515151"));
mAdapter = new GirlRecyclerAdapter(getActivity());
getBinding().recyclerGirl.setAdapter(mAdapter);
StaggeredGridLayoutManager staggeredGridLayoutManager
= new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
getBinding().recyclerGirl.setLayoutManager(staggeredGridLayoutManager);
getBinding().recyclerGirl.setOnScrollListener(new LoadMoreRecyclerOnScrollListener(staggeredGridLayoutManager) {
@Override
public void onLoadMore(int current_page) {
mCurrentPage = current_page;
loadMore(current_page);
}
});
getBinding().swipeRefreshGirl.setOnRefreshListener(this);
getBinding().swipeRefreshGirl.setRefreshing(true);
onRefresh();
}
示例5: isLastColum
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) {
int orientation = ((StaggeredGridLayoutManager) layoutManager)
.getOrientation();
if (orientation == StaggeredGridLayoutManager.VERTICAL) {
if ((pos + 1) % spanCount == 0)// 如果是最后一列,则不需要绘制右边
{
return true;
}
} else {
childCount = childCount - childCount % spanCount;
if (pos >= childCount)// 如果是最后一列,则不需要绘制右边
return true;
}
}
return false;
}
示例6: isLastRaw
private boolean isLastRaw(RecyclerView parent, int pos, int spanCount, int childCount) {
LayoutManager layoutManager = parent.getLayoutManager();
if (layoutManager instanceof GridLayoutManager) {
childCount = childCount - childCount % spanCount;
if (pos >= childCount)// 如果是最后一行,则不需要绘制底部
return true;
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
int orientation = ((StaggeredGridLayoutManager) layoutManager)
.getOrientation();
// StaggeredGridLayoutManager 且纵向滚动
if (orientation == StaggeredGridLayoutManager.VERTICAL) {
childCount = childCount - childCount % spanCount;
// 如果是最后一行,则不需要绘制底部
if (pos >= childCount)
return true;
} else
// StaggeredGridLayoutManager 且横向滚动
{
// 如果是最后一行,则不需要绘制底部
if ((pos + 1) % spanCount == 0) {
return true;
}
}
}
return false;
}
示例7: isLastRaw
private boolean isLastRaw(RecyclerView parent, int pos, int spanCount,
int childCount)
{
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
if (layoutManager instanceof GridLayoutManager)
{
childCount = childCount - childCount % spanCount;
if (pos >= childCount)// 如果是最后一行,则不需要绘制底部
return true;
} else if (layoutManager instanceof StaggeredGridLayoutManager)
{
int orientation = ((StaggeredGridLayoutManager) layoutManager)
.getOrientation();
// StaggeredGridLayoutManager 且纵向滚动
if (orientation == StaggeredGridLayoutManager.VERTICAL)
{
childCount = childCount - childCount % spanCount;
// 如果是最后一行,则不需要绘制底部
if (pos >= childCount)
return true;
} else
// StaggeredGridLayoutManager 且横向滚动
{
// 如果是最后一行,则不需要绘制底部
if ((pos + 1) % spanCount == 0)
{
return true;
}
}
}
return false;
}
示例8: initView
@Override
protected void initView() {
setToolbar(false);
StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
mAdapter = new GirlsListAdapter(this);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.addOnScrollListener(getOnBottomListener(layoutManager));
mRefreshLayout.setOnRefreshListener(() -> {
mPage = 1;
loadFromNet(true);
});
}
示例9: isLastRaw
private boolean isLastRaw(RecyclerView parent, int pos, int spanCount,
int childCount) {
LayoutManager layoutManager = parent.getLayoutManager();
if (layoutManager instanceof GridLayoutManager) {
childCount = childCount - childCount % spanCount;
if (pos >= childCount)// 如果是最后一行,则不需要绘制底部
return true;
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
int orientation = ((StaggeredGridLayoutManager) layoutManager)
.getOrientation();
// StaggeredGridLayoutManager 且纵向滚动
if (orientation == StaggeredGridLayoutManager.VERTICAL) {
childCount = childCount - childCount % spanCount;
// 如果是最后一行,则不需要绘制底部
if (pos >= childCount)
return true;
} else
// StaggeredGridLayoutManager 且横向滚动
{
// 如果是最后一行,则不需要绘制底部
if ((pos + 1) % spanCount == 0) {
return true;
}
}
}
return false;
}
示例10: isLastColum
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)
{
int orientation = ((StaggeredGridLayoutManager) layoutManager).getOrientation();
if (orientation == StaggeredGridLayoutManager.VERTICAL)
{
if ((pos + 1) % spanCount == 0)// 如果是最后一列,则不需要绘制右边
{
return true;
}
}
else
{
childCount = childCount - childCount % spanCount;
if (pos >= childCount)// 如果是最后一列,则不需要绘制右边
return true;
}
}
return false;
}
示例11: onCreateView
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_videos, container, false);
RecyclerView recyclerView = root.findViewById(R.id.recycler_view);
mSwipeRefreshLayout = root.findViewById(R.id.refresh);
mSwipeRefreshLayout.setOnRefreshListener(() -> getPresenter().fireRefresh());
ViewUtils.setupSwipeRefreshLayoutWithCurrentTheme(getActivity(), mSwipeRefreshLayout);
mEmpty = root.findViewById(R.id.empty);
int columns = getContext().getResources().getInteger(R.integer.videos_column_count);
StaggeredGridLayoutManager manager = new StaggeredGridLayoutManager(columns, StaggeredGridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(manager);
recyclerView.addOnScrollListener(new PicassoPauseOnScrollListener(VideoAlbumsNewAdapter.PICASSO_TAG));
recyclerView.addOnScrollListener(new EndlessRecyclerOnScrollListener() {
@Override
public void onScrollToLastElement() {
getPresenter().fireScrollToLast();
}
});
mAdapter = new VideoAlbumsNewAdapter(getActivity(), Collections.emptyList());
mAdapter.setListener(this);
recyclerView.setAdapter(mAdapter);
resolveEmptyTextVisibility();
return root;
}
示例12: isLastRaw
private boolean isLastRaw(RecyclerView parent, int pos, int spanCount,
int childCount) {
LayoutManager layoutManager = parent.getLayoutManager();
if (layoutManager instanceof GridLayoutManager) {
childCount = childCount - childCount % spanCount;
if (pos >= childCount)// 如果是最后一行,则不需要绘制底部
return true;
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
int orientation = ((StaggeredGridLayoutManager) layoutManager)
.getOrientation();
// StaggeredGridLayoutManager 且纵向滚动
if (orientation == StaggeredGridLayoutManager.VERTICAL) {
childCount = childCount - childCount % spanCount + 1;
// 如果是最后一行,则不需要绘制底部
if (pos >= childCount)
return true;
} else
// StaggeredGridLayoutManager 且横向滚动
{
// 如果是最后一行,则不需要绘制底部
if ((pos + 1) % spanCount == 0) {
return true;
}
}
}
return false;
}
示例13: setLayoutManager
private void setLayoutManager(RecyclerView recyclerView) {
final StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(SPAN_COUNT, StaggeredGridLayoutManager.VERTICAL);
GridLayoutManager.SpanSizeLookup spanSizeLookup = new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
Object item = items.get(position);
if (item instanceof Bean01) {
return 1;
}
if (item instanceof Bean02) {
return 1;
}
if (item instanceof Bean03) {
return SPAN_COUNT;
}
if (item instanceof Bean04) {
return SPAN_COUNT;
}
if (item instanceof String) {
return SPAN_COUNT;
}
return 1;
}
};
// layoutManager.setSpanSizeLookup(spanSizeLookup);
// layoutManager.setSpanCount(2);
recyclerView.setLayoutManager(layoutManager);
}
示例14: isLastRaw
private boolean isLastRaw(RecyclerView parent, int pos, int spanCount,
int childCount)
{
LayoutManager layoutManager = parent.getLayoutManager();
if (layoutManager instanceof GridLayoutManager)
{
childCount = childCount - childCount % spanCount;
if (pos >= childCount)// 如果是最后一行,则不需要绘制底部
return true;
} else if (layoutManager instanceof StaggeredGridLayoutManager)
{
int orientation = ((StaggeredGridLayoutManager) layoutManager)
.getOrientation();
// StaggeredGridLayoutManager 且纵向滚动
if (orientation == StaggeredGridLayoutManager.VERTICAL)
{
childCount = childCount - childCount % spanCount;
// 如果是最后一行,则不需要绘制底部
if (pos >= childCount)
return true;
} else
// StaggeredGridLayoutManager 且横向滚动
{
// 如果是最后一行,则不需要绘制底部
if ((pos + 1) % spanCount == 0)
{
return true;
}
}
}
return false;
}
示例15: isLastRaw
private boolean isLastRaw(RecyclerView parent, int pos, int spanCount,
int childCount)
{
LayoutManager layoutManager = parent.getLayoutManager();
if (layoutManager instanceof GridLayoutManager)
{
childCount = childCount - childCount % spanCount;
if (pos >= childCount)// 如果是最后一行,则不需要绘制底部
return true;
} else if (layoutManager instanceof StaggeredGridLayoutManager)
{
int orientation = ((StaggeredGridLayoutManager) layoutManager)
.getOrientation();
// StaggeredGridLayoutManager 且纵向滚动
if (orientation == StaggeredGridLayoutManager.VERTICAL)
{
childCount = childCount - childCount % spanCount;
// 如果是最后一行,则不需要绘制底部
if (pos >= childCount)
return true;
} else
// StaggeredGridLayoutManager 且横向滚动
{
// 如果是最后一行,则不需要绘制底部
if ((pos + 1) % spanCount == 0)
{
return true;
}
}
}
return false;
}