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


Java GridLayoutManager.setOrientation方法代码示例

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


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

示例1: initRecyclerView

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
protected void initRecyclerView()
{

    mLiveAppIndexAdapter = new LiveAppIndexAdapter(getActivity());
    mRecyclerView.setAdapter(mLiveAppIndexAdapter);
    GridLayoutManager layout = new GridLayoutManager(getActivity(), 12);
    layout.setOrientation(LinearLayoutManager.VERTICAL);
    layout.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup()
    {

        @Override
        public int getSpanSize(int position)
        {

            return mLiveAppIndexAdapter.getSpanSize(position);
        }
    });

    mRecyclerView.setLayoutManager(layout);
}
 
开发者ID:WeDevelopTeam,项目名称:HeroVideo-master,代码行数:21,代码来源:HomeLiveFragment.java

示例2: setLayoutManger

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
public SmartRecycleView setLayoutManger(LayoutManagerType layoutManagerType, int orientation, int spanCout) {
    RecyclerView.LayoutManager layoutManager = null;
    if (layoutManagerType == LayoutManagerType.LINEAR_LAYOUT) {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext);
        linearLayoutManager.setOrientation(orientation);
        layoutManager = linearLayoutManager;
    } else if (layoutManagerType == LayoutManagerType.GRID_LAYOUT) {
        GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, spanCout);
        gridLayoutManager.setOrientation(orientation);
        layoutManager = gridLayoutManager;
    } else if (layoutManagerType == LayoutManagerType.STAGGER_LAYOUT) {
        StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(spanCout, orientation);
        layoutManager = staggeredGridLayoutManager;
    }
    mRecyclerView.setLayoutManager(layoutManager);
    return this;
}
 
开发者ID:GaoGersy,项目名称:AutoRecycleView,代码行数:18,代码来源:SmartRecycleView.java

示例3: initRecyclerView

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
@Override
public void initRecyclerView() {

  mLiveAppIndexAdapter = new LiveAppIndexAdapter(LiveAppIndexActivity.this);
  mRecyclerView.setAdapter(mLiveAppIndexAdapter);
  GridLayoutManager layout = new GridLayoutManager(LiveAppIndexActivity.this, 12);
  layout.setOrientation(LinearLayoutManager.VERTICAL);
  layout.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

    @Override
    public int getSpanSize(int position) {

      return mLiveAppIndexAdapter.getSpanSize(position);
    }
  });

  mRecyclerView.setLayoutManager(layout);
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:19,代码来源:LiveAppIndexActivity.java

示例4: initRecyclerView

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
@Override
protected void initRecyclerView() {

  mLiveAppIndexAdapter = new LiveAppIndexAdapter(getActivity());
  mRecyclerView.setAdapter(mLiveAppIndexAdapter);
  GridLayoutManager layout = new GridLayoutManager(getActivity(), 12);
  layout.setOrientation(LinearLayoutManager.VERTICAL);
  layout.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

    @Override
    public int getSpanSize(int position) {

      return mLiveAppIndexAdapter.getSpanSize(position);
    }
  });

  mRecyclerView.setLayoutManager(layout);
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:19,代码来源:HomeLiveFragment.java

示例5: setGView

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
private void setGView() {
    GridLayoutManager manager = new GridLayoutManager(mContext, mNunColumns);
    if (mRecyclerViewStyle == RecyclerViewStyle.HorizontalGridView) {
        manager.setOrientation(GridLayoutManager.HORIZONTAL);
    } else {
        manager.setOrientation(GridLayoutManager.VERTICAL);
    }
    if (mAdapter != null) {
        if (mAdapter.isAddFoot() || mAdapter.isAddHead()) {
            //将gridview的头部或者尾部设置成
            manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
                @Override
                public int getSpanSize(int position) {
                    if (position < mAdapter.getmHeaderArraySize()||
                            position>=mAdapter.getmHeaderArraySize()+mAdapter.getmDatas().size()) {
                        return mNunColumns;
                    } else {
                        return 1;
                    }
                }
            });
        }
    }
    mRecyclerView.setLayoutManager(manager);
}
 
开发者ID:liusmallpig,项目名称:LowRecyclerView,代码行数:26,代码来源:RecyclerViewUtils.java

示例6: onCreateView

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_movies_watch_later, container, false);
    ButterKnife.bind(this, view);

    realm = Realm.getDefaultInstance();

    GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 2);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);

    if (Build.VERSION.SDK_INT >= 21) {
        getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark));
    }

    rvMoviesWatchLater.setLayoutManager(layoutManager);

    rvMoviesWatchLater.setAdapter(new MoviesWatchLaterAdapter(realm.where(Movie.class)
            .equalTo("isWatchLater", true).findAllAsync(), true, this));

    return view;
}
 
开发者ID:hsm59,项目名称:WatchIt,代码行数:23,代码来源:MoviesWatchLaterFragment.java

示例7: onCreateView

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
    Bundle savedInstanceState) {
  View result = inflater.inflate(R.layout.recycler_view, container, false);
  recyclerView = (RecyclerView) result.findViewById(R.id.recycler_view);
  GridLayoutManager layoutManager = new GridLayoutManager(getActivity(), 1);
  layoutManager.setOrientation(RecyclerView.HORIZONTAL);
  recyclerView.setLayoutManager(layoutManager);
  recyclerView.setHasFixedSize(true);

  return result;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:HorizontalGalleryFragment.java

示例8: onCreate

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);

    SimpleAdapter adapter = new SimpleAdapter(this);
    GridLayoutManager manager = new GridLayoutManager(this, 3);
    manager.setOrientation(OrientationHelper.VERTICAL);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.main_recyclerview);
    recyclerView.setLayoutManager(manager);
    recyclerView.setAdapter(adapter);
    recyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(this).build());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:SimpleGridActivity.java

示例9: setGridLayout

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
/**
 * GridLayoutManager
 */

public void setGridLayout(int spanCount) {

    GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, spanCount);
    gridLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(gridLayoutManager);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:PullLoadMoreRecyclerView.java

示例10: onCreateView

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
@Override
public View onCreateView(
    @NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  View result = inflater.inflate(R.layout.recycler_view, container, false);
  recyclerView = (RecyclerView) result.findViewById(R.id.recycler_view);
  GridLayoutManager layoutManager = new GridLayoutManager(getActivity(), 1);
  layoutManager.setOrientation(RecyclerView.HORIZONTAL);
  recyclerView.setLayoutManager(layoutManager);
  recyclerView.setHasFixedSize(true);

  return result;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:HorizontalGalleryFragment.java

示例11: initializeGridRecyclerView

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
private void initializeGridRecyclerView(final View layout) {
  // Get RecyclerView
  mRecyclerView = UI.findViewById(layout, R.id.recycler_view);
  // Choose the LayoutManager
  GridLayoutManager layoutManager = new GridLayoutManager(getContext(), mConfig.gridSpanCount);
  layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  layoutManager.scrollToPosition(0);
  mRecyclerView.setLayoutManager(layoutManager);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:MainFragment.java

示例12: initRecyclerView

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
@Override
protected void initRecyclerView() {
    mLiveAppIndexAdapter = new LiveAppIndexAdapter(getActivity());
    mRecyclerView.setAdapter(mLiveAppIndexAdapter);
    GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 12);
    gridLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            return mLiveAppIndexAdapter.getSpanSize(position);
        }
    });
    mRecyclerView.setLayoutManager(gridLayoutManager);
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:15,代码来源:HomeLiveFragment.java

示例13: initEvents

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
@Override
protected void initEvents() {

    mToolbar.setTitle("Bookshelf");
    spanCount = getResources().getInteger(R.integer.gallery_span_count);
    mBookshelfPresenter = new BookshelfPresenterImpl(this);


    /*mSwipeRefreshLayout.setColorSchemeResources(R.color.recycler_color1, R.color.recycler_color2,
            R.color.recycler_color3, R.color.recycler_color4);*/

    mLayoutManager = new GridLayoutManager(getActivity(), spanCount);
    mLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            return mBookshelfAdapter.getItemColumnSpan(position);
        }
    });
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(mLayoutManager);

    mBookshelfs = new ArrayList<>();
    mBookshelfAdapter = new BookshelfAdapter(mBookshelfs, getActivity(), spanCount);
    mBookshelfAdapter.setOnAdjustmentConfirmListener(this);
    mBookshelfAdapter.setOnDeleteConfirmListener(this);
    mBookshelfAdapter.setOnBookshelfClickListener((BookshelfAdapter.OnBookshelfClickListener) getActivity());
    mRecyclerView.setAdapter(mBookshelfAdapter);

    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    final int space = DensityUtils.dp2px(getActivity(), 4);
    mRecyclerView.addItemDecoration(new StaggeredGridDecoration(space, space, space, space, spanCount));
    onRefresh();
}
 
开发者ID:chengkun123,项目名称:ReadMark,代码行数:34,代码来源:BookshelfFragment.java

示例14: onActivityCreated

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    LogUtils.i(TAG, "onActivityCreated");

    mAdapter = new AlbumsAdapter(mContext, new ArrayList<Album>());

    GridLayoutManager layoutManager = new GridLayoutManager(mContext, 2);
    layoutManager.setOrientation(GridLayoutManager.VERTICAL);

    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setAdapter(mAdapter);
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:16,代码来源:AlbumsFragment.java

示例15: onCreate

import android.support.v7.widget.GridLayoutManager; //导入方法依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    setToolbar(false);
    goToSplashActivity();

    final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    recyclerView.setHasFixedSize(true);
    final GridLayoutManager llm = new GridLayoutManager(this, 2);
    llm.setOrientation(GridLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(llm);

    final ArrayList<CardViewModel> data = new ArrayList<>();
    for (int i = 0; i < getStringArrayByResources(this, R.array.card_titles).length; i++) {
        data.add(new CardViewModel(
                getStringArrayByResources(this, R.array.card_titles)[i],
                getDrawableArrayByResources(this, R.array.card_icons).getResourceId(i, -1),
                getStringArrayByResources(this, R.array.card_activities)[i]
        ));
    }

    final View.OnClickListener onClickListener = new CardOnClickListener(this, recyclerView);
    final RecyclerView.Adapter<RecyclerViewAdapter.RecyclerViewHolder> adapter = new RecyclerViewAdapter(data, onClickListener);
    recyclerView.setAdapter(adapter);

}
 
开发者ID:SofiaRosetti,项目名称:S3-16-d-rescue,代码行数:29,代码来源:MainActivity.java


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