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


Java StaggeredGridLayoutManager.setGapStrategy方法代码示例

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


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

示例1: onCreate

import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    ActivityCompat.setExitSharedElementCallback(this, exitTransitionCallback);
    super.onCreate(savedInstanceState);

    int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    getWindow().getDecorView().setSystemUiVisibility(mUIFlag);

    setContentView(R.layout.activity_gallery);
    ButterKnife.bind(this);

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    ArrayList<String> imagesList = new ArrayList<>();
    for (int i = 1; i <= 23; i++)
        imagesList.add("http://ssninstincts.org.in/img/gallery/big/" + i + ".jpg");

    galleryAdapter = new GalleryAdapter(this, imagesList);
    StaggeredGridLayoutManager gridLayoutManager =
            new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
    gridLayoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS);
    galleryRecyclerView.setHasFixedSize(true);
    galleryRecyclerView.setLayoutManager(gridLayoutManager);
    galleryRecyclerView.setAdapter(galleryAdapter);
}
 
开发者ID:adithya321,项目名称:Instincts-2k17,代码行数:34,代码来源:GalleryActivity.java

示例2: onCreateView

import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    View view=View.inflate(UIUtils.getContext(), R.layout.talking_pager,null);

    mRecycler = (RecyclerView) view.findViewById(R.id.icon_recycler);
    layoutManager = new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL);
    layoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE);
    mRecycler.setLayoutManager(layoutManager);

    initData();

    initListener();

    return view;
}
 
开发者ID:android-jian,项目名称:topnews,代码行数:18,代码来源:TalkingFragment.java

示例3: initEventAndData

import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
protected void initEventAndData() {
    mList = new ArrayList<>();
    mAdapter = new GirlAdapter(mContext, mList);
    mStaggeredGridLayoutManager = new StaggeredGridLayoutManager(SPAN_COUNT,StaggeredGridLayoutManager.VERTICAL);
    mStaggeredGridLayoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE);
    //fix issue #52 https://github.com/codeestX/GeekNews/issues/52
    mStaggeredGridLayoutManager.setItemPrefetchEnabled(false);
    rvGirlContent.setLayoutManager(mStaggeredGridLayoutManager);
    rvGirlContent.setAdapter(mAdapter);
    swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            mPresenter.getGirlData();
        }
    });
    rvGirlContent.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            int[] visibleItems = mStaggeredGridLayoutManager.findLastVisibleItemPositions(null);
            int lastItem = Math.max(visibleItems[0],visibleItems[1]);
            if (lastItem > mAdapter.getItemCount() - 5 && !isLoadingMore && dy > 0 ) {
                isLoadingMore = true;
                mPresenter.getMoreGirlData();
            }
        }
    });
    mAdapter.setOnItemClickListener(new GirlAdapter.OnItemClickListener() {
        @Override
        public void onItemClickListener(int position, View shareView) {
            Intent intent = new Intent();
            intent.setClass(mContext, GirlDetailActivity.class);
            intent.putExtra("url",mList.get(position).getUrl());
            intent.putExtra("id",mList.get(position).get_id());
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(mActivity, shareView, "shareView");
            mContext.startActivity(intent,options.toBundle());
        }
    });
    ivProgress.start();
    mPresenter.getGirlData();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:GirlFragment.java

示例4: initEventAndData

import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
protected void initEventAndData() {
    mList = new ArrayList<>();
    mAdapter = new GirlAdapter(mContext, mList);
    mStaggeredGridLayoutManager = new StaggeredGridLayoutManager(SPAN_COUNT,StaggeredGridLayoutManager.VERTICAL);
    mStaggeredGridLayoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE);
    //fix issue #52 https://github.com/codeestX/GeekNews/issues/52
    mStaggeredGridLayoutManager.setItemPrefetchEnabled(false);
    rvGirlContent.setLayoutManager(mStaggeredGridLayoutManager);
    rvGirlContent.setAdapter(mAdapter);
    swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            mPresenter.getGirlData();
        }
    });
    rvGirlContent.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            int[] visibleItems = mStaggeredGridLayoutManager.findLastVisibleItemPositions(null);
            int lastItem = Math.max(visibleItems[0],visibleItems[1]);
            if (lastItem > mAdapter.getItemCount() - 5 && !isLoadingMore && dy > 0 ) {
                isLoadingMore = true;
                mPresenter.getMoreGirlData();
            }
        }
    });
    mAdapter.setOnItemClickListener(new GirlAdapter.OnItemClickListener() {
        @Override
        public void onItemClickListener(int position, View shareView) {
            Intent intent = new Intent();
            intent.setClass(mContext, GirlDetailActivity.class);
            intent.putExtra(Constants.IT_GANK_GRIL_URL, mList.get(position).getUrl());
            intent.putExtra(Constants.IT_GANK_GRIL_ID, mList.get(position).get_id());
            ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(mActivity, shareView, "shareView");
            mContext.startActivity(intent,options.toBundle());
        }
    });
    stateLoading();
    mPresenter.getGirlData();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:GirlFragment.java


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