當前位置: 首頁>>代碼示例>>Java>>正文


Java StaggeredGridLayoutManager.VERTICAL屬性代碼示例

本文整理匯總了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;
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:16,代碼來源:UserStatusFragment.java

示例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();
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:22,代碼來源:UserReplyActivity.java

示例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;
}
 
開發者ID:ymqq,項目名稱:CommonFramework,代碼行數:22,代碼來源:DividerGridItemDecoration.java

示例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();

}
 
開發者ID:wheat7,項目名稱:Cashew,代碼行數:21,代碼來源:GirlFragment.java

示例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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:DividerGridItemDecoration.java

示例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;
}
 
開發者ID:OCNYang,項目名稱:RecyclerViewEvent,代碼行數:26,代碼來源:DividerGridItemDecoration.java

示例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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:32,代碼來源:DividerGridItemDecoration.java

示例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);
    });
}
 
開發者ID:weixianshishen,項目名稱:BeautifulGirls,代碼行數:13,代碼來源:MainActivity.java

示例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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:27,代碼來源:DividerGridItemDecoration.java

示例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;
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:30,代碼來源:DividerGridItemDecoration.java

示例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;
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:31,代碼來源:VideoAlbumsFragment.java

示例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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:27,代碼來源:DividerGridItemDecoration.java

示例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);
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:28,代碼來源:WaterFallActivity.java

示例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;
}
 
開發者ID:henrymorgen,項目名稱:android-advanced-light,代碼行數:32,代碼來源:DividerGridItemDecoration.java

示例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;
}
 
開發者ID:HStanN,項目名稱:TakeRest,代碼行數:32,代碼來源:DividerGridItemDecoration.java


注:本文中的android.support.v7.widget.StaggeredGridLayoutManager.VERTICAL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。