gridlayoutmanager

How to give space between gridview in through java

南笙酒味 提交于 2019-12-02 07:08:04
How do i get perfect aligning between the gridView items, i have added the gridview using java and it's base adapter is set in which i added the image and textview. Xml Code: <android.support.v7.widget.CardView android:layout_width="180dp" android:layout_height="200dp" android:layout_margin="5dp" android:orientation="vertical" app:cardCornerRadius="5dp" app:cardElevation="5dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android

GridLayoutManager with different column count per row

旧城冷巷雨未停 提交于 2019-12-02 03:40:50
I'm trying to build a RecyclerView with a GridLayoutManager which has a variable column count per row, something like this: The sum of the width of all items in the same row will always be the screen width. I tried to re-organize the list of items, grouping them by list of rows, and then inflating a LinearLayout per row. It didn't work quite well. So I'm stuck and out of ideas. Any help would be really appreciated You can use GridLayoutManager. To have different column count in row you have to override setSpanSizeLookup . Example: //spanCount = 3 (just for example) GridLayoutManager

GridLayoutManager Span Size RecycleView

别等时光非礼了梦想. 提交于 2019-12-01 01:37:38
I'm trying to achieve a layout similar to the picture above with the RecyclerView in conjunction with the GridLayoutManager, i tried setting the setSpanSizeLookup based on position but couldn't mimic the design above.. anyone could help please? UPDATE private GridLayoutManager getGridLayoutManager() { final GridLayoutManager manager = new GridLayoutManager(getActivity(), 6); manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { int index = postion % 5; switch(index){ case 0: return 2; case 1: return 2; case 2: return 2; case 3:

Android: how to implement grid with different columns/rows size

只谈情不闲聊 提交于 2019-11-30 23:02:39
I need to implement something like this: Seems like StaggeredGridLayoutManager | GridLayoutManager can not do it, how to achieve it for now? GridView has good performance? You can achieve this kind of RecyclerView behavior with twoway-view I tested the 1.0.0-SNAPSHOT version of this lib. It's kind of old project (not maintened anymore), but it can help you to write your own RecyclerView/LayoutManager. Example of your layout In RecyclerViewAdapter you need to set the span logic: @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { super.onBindViewHolder(holder,

Android: how to implement grid with different columns/rows size

和自甴很熟 提交于 2019-11-30 17:51:38
问题 I need to implement something like this: Seems like StaggeredGridLayoutManager | GridLayoutManager can not do it, how to achieve it for now? GridView has good performance? 回答1: You can achieve this kind of RecyclerView behavior with twoway-view I tested the 1.0.0-SNAPSHOT version of this lib. It's kind of old project (not maintened anymore), but it can help you to write your own RecyclerView/LayoutManager. Example of your layout In RecyclerViewAdapter you need to set the span logic: @Override

How to make RecyclerView scroll smoothly?

只谈情不闲聊 提交于 2019-11-30 10:57:31
This is more like a generic question, but after lot of search and try I am not able to understand why this is so difficult to achieve. This is the closest answer I can find but still unable to implement. To be specific I am using RecyclerView with GridLayoutManager. All I want is the grid layout to scroll smoothly (like default gallary app) ,nothing fancy, but the default implementation of grid layout manager scrolls the view in a 'jerky' manner. I tried to implement the method from above link but unsuccessfully. I also tried to implement LinearSmoothScroller but I am not sure how to implement

How to make RecyclerView scroll smoothly?

谁说胖子不能爱 提交于 2019-11-29 16:12:03
问题 This is more like a generic question, but after lot of search and try I am not able to understand why this is so difficult to achieve. This is the closest answer I can find but still unable to implement. To be specific I am using RecyclerView with GridLayoutManager. All I want is the grid layout to scroll smoothly (like default gallary app) ,nothing fancy, but the default implementation of grid layout manager scrolls the view in a 'jerky' manner. I tried to implement the method from above

How to design spannable gridview using recyclerview (SpannableGridLayoutManager)

与世无争的帅哥 提交于 2019-11-29 13:04:33
I want to design grid view like below image provided. The first item should be bigger than the rest. Currently I am using RelativeLayout with GridLayoutManager check below code RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view1); RecyclerView.LayoutManager recyclerViewLayoutManager = new GridLayoutManager(context, 3); recyclerView.setLayoutManager(recyclerViewLayoutManager); recyclerView_Adapter = new RecyclerViewAdapter(context,numbers); recyclerView.setAdapter(recyclerView_Adapter); Dummy array for demo String[] numbers = { "one", "two", "three", "four", "five", "six

How to implement horizontal gridlayoutmanager

故事扮演 提交于 2019-11-29 06:46:44
问题 How to implement horizontal gridlayoutmanager with recyclerview. Fixed row count. and horizontal scroll. Like this... gridLayoutManager = new GridLayoutManager(getContext(), 1, GridLayoutManager.HORIZONTAL, false); recyclerView.setLayoutManager(gridLayoutManager); recyclerView.setHasFixedSize(true); I try do this. but this is not show anything in item. 回答1: Implement RecyclerAdapter, ViewHolder. Instantiate RecyclerAdapter, set its' adapter. Specify ROWSCOUNT (there are 3 rows on your picture

Different (dynamic) items height in GridLayoutManager

我的未来我决定 提交于 2019-11-29 03:57:37
I have a RecyclerView and GridLayoutManager with 2 columns. How can I force LayoutManager to be according with template on the first screenshot? Now I have result as on the 2th screenshot. Need result: Current result: GridLayoutManager will use a grid, and you can set some span, but not different heights for different cells. What you want is a StaggeredGridLayoutManager . This will just put the items on the screen if they fit, leading to your needed result. You can also change the reordering behavior, if you want to, by using setGapStrategy . It's really easy. You have to add this manager to