本文整理了Java中android.support.v7.widget.GridLayoutManager.setOrientation()
方法的一些代码示例,展示了GridLayoutManager.setOrientation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridLayoutManager.setOrientation()
方法的具体详情如下:
包路径:android.support.v7.widget.GridLayoutManager
类名称:GridLayoutManager
方法名:setOrientation
暂无
代码示例来源:origin: bumptech/glide
@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;
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@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);
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@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);
}
代码示例来源:origin: yqritc/RecyclerView-FlexibleDivider
@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());
}
代码示例来源:origin: ppamorim/Dragger
@Override protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
String[] items = getResources().getStringArray(R.array.home);
ArrayList<Renderable> renderables = new ArrayList<>(items.length);
for (String text : items) {
renderables.add(new Home(text));
}
observableRecyclerView.setHasFixedSize(true);
observableRecyclerView.setItemAnimator(new DefaultItemAnimator());
GridLayoutManager layoutManager = new GridLayoutManager(this, 2);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
observableRecyclerView.setLayoutManager(layoutManager);
observableRecyclerView.setAdapter(
new RendererAdapter(renderables,
new RendererBuilder(new Factory()),
LayoutInflater.from(this)));
}
代码示例来源:origin: chiclaim/AndroidMVVMSample
public static void setGridManagerAndAdapter(RecyclerView recyclerView,
RecyclerView.Adapter adapter, int spanCount) {
GridLayoutManager gridLayoutManager = new GridLayoutManager(recyclerView.getContext(), spanCount);
gridLayoutManager.setOrientation(VERTICAL);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(gridLayoutManager);
recyclerView.setAdapter(adapter);
}
代码示例来源:origin: BoBoMEe/Android-Demos
@Override public void onChange() {
if (null != mGridLayoutManager) {
int orientation = mGridLayoutManager.getOrientation();
mGridLayoutManager.setOrientation(
orientation == GridLayoutManager.VERTICAL ? GridLayoutManager.HORIZONTAL
: GridLayoutManager.VERTICAL);
}
}
代码示例来源:origin: xiaole0310/MyMusicPlayer
private void setRecyclerViewAdapter(){
recyclerViewAdapter = new RecyclerViewAdapter(this, rankingtitleList, this);
GridLayoutManager layoutManager = new GridLayoutManager(this, 2);
recyclerView.setLayoutManager(layoutManager);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setAdapter(recyclerViewAdapter);
}
代码示例来源:origin: BoBoMEe/Android-Demos
@Override public void onChange() {
if (null != mGridLayoutManager) {
int orientation = mGridLayoutManager.getOrientation();
mGridLayoutManager.setOrientation(
orientation == GridLayoutManager.VERTICAL ? GridLayoutManager.HORIZONTAL
: GridLayoutManager.VERTICAL);
}
}
代码示例来源:origin: BoBoMEe/Android-Demos
@Override public void onChange() {
if (null != mGridLayoutManager) {
int orientation = mGridLayoutManager.getOrientation();
mGridLayoutManager.setOrientation(
orientation == GridLayoutManager.VERTICAL ? GridLayoutManager.HORIZONTAL
: GridLayoutManager.VERTICAL);
}
}
代码示例来源:origin: BoBoMEe/Android-Demos
@Override public void onChange() {
if (null != mGridLayoutManager) {
int orientation = mGridLayoutManager.getOrientation();
mGridLayoutManager.setOrientation(
orientation == GridLayoutManager.VERTICAL ? GridLayoutManager.HORIZONTAL
: GridLayoutManager.VERTICAL);
}
}
代码示例来源:origin: whyalwaysmea/BigBoom
@Override
protected void initView() {
mSwipeRefreshLayout.setColorSchemeResources(R.color.material_amber_500, R.color.material_blue_500,
R.color.material_cyan_500, R.color.material_deep_purple_500);
mSwipeRefreshLayout.setOnRefreshListener(this);
mLayoutManager = new GridLayoutManager(getContext(), 1);
mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setHasFixedSize(true);
}
代码示例来源:origin: happylishang/RecyclerItemDecoration
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GridLayoutManager layoutManager = new GridLayoutManager(this, 6);
mRecyclerView.setLayoutManager(layoutManager);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
GridLayoutItemDecoration itemDecoration = new GridLayoutItemDecoration(6);
itemDecoration.setDivideParams(10, 10);
mRecyclerView.addItemDecoration(itemDecoration);
mRecyclerView.setAdapter(new BaseVerticalAdapter(100));
}
}
代码示例来源:origin: hejunlin2013/TVSample
private void loadRecyclerViewMenuItem() {
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.ry_menu_item);
GridLayoutManager layoutManager = new GridLayoutManager(this, 1);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setFocusable(false);
mMetroViewBorderImpl.attachTo(recyclerView);
createOptionItemData(recyclerView, R.layout.detail_menu_item);
}
代码示例来源:origin: evilbinary/TvWidget
private void testRecyclerViewLinerLayout() {
//test linearlayout
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.firstRecyclerView);
// 创建一个线性布局管理器
GridLayoutManager layoutManager = new GridLayoutManager(this,1);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setFocusable(false);
border.attachTo(recyclerView);
createData(recyclerView, R.layout.item3);
}
代码示例来源:origin: hejunlin2013/LivePlayback
private void loadRecyclerViewMenuItem() {
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.ry_menu_item);
GridLayoutManager layoutManager = new GridLayoutManager(this, 1);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setFocusable(false);
mMetroViewBorderImpl.attachTo(recyclerView);
createOptionItemData(recyclerView, R.layout.detail_menu_item);
}
代码示例来源:origin: windrunnerlihuan/DogCamera
protected RecyclerView createRecyclerView() {
RecyclerView pager = new RecyclerView(getContext());
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 4);
layoutManager.setOrientation(GridLayoutManager.VERTICAL);
pager.setLayoutManager(layoutManager);
pager.addItemDecoration(new BaseRecyclerViewAdapter.DividerGridItemDecoration(getResources().getDrawable(R.drawable.preview_chart_recycler_item_divider)));
ViewGroup.LayoutParams pagerLp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
pager.setLayoutParams(pagerLp);
return pager;
}
代码示例来源:origin: hejunlin2013/TVSample
private void loadDataForRecyclerViewGridLayout() {
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.ry_detail_list);
GridLayoutManager gridlayoutManager = new AutoLayoutManager(this, 4);
gridlayoutManager.setOrientation(GridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(gridlayoutManager);
recyclerView.setFocusable(false);
mMetroViewBorderImpl.attachTo(recyclerView);
createData(recyclerView, R.layout.detail_list_item);
}
代码示例来源:origin: evilbinary/TvWidget
private void testRecyclerViewGridLayout() {
//test grid
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.secondRecyclerView);
GridLayoutManager gridlayoutManager = new TvGridLayoutManagerScrolling(this, 4);
gridlayoutManager.setOrientation(GridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(gridlayoutManager);
recyclerView.setFocusable(false);
border.attachTo(recyclerView);
createData(recyclerView,R.layout.item);
}
代码示例来源:origin: evilbinary/TvWidget
private void testRecyclerViewGridLayout() {
//test grid
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
GridLayoutManager gridlayoutManager = new TvGridLayoutManagerScrolling(this, 4);
gridlayoutManager.setOrientation(GridLayoutManager.HORIZONTAL);
recyclerView.setLayoutManager(gridlayoutManager);
recyclerView.setFocusable(false);
border.attachTo(recyclerView);
createData(recyclerView);
}
内容来源于网络,如有侵权,请联系作者删除!