I'm trying to achieve a design for recycler view in grid layout style. Any Input towards achieving it is very helpful.
I have to design for span size 2 only.
Design :
I tried to use GridLayoutManager with span size 2
If you mean that list should scroll horizontally and each next column should be following of previous one. I think you can done it by horizontal recycler view with items that contain two views and top space margin which increases sequentially.
Height of the RecyclerView should be calculated and set by last column in code.
Related
I have a requirement in which there will be multiple child items to a RecycylerView Item. As per the requirement a single recycler view item can have maximum of four horizontal Childs and 2 vertical Childs at max. I have used recyclerview inside a recyclerview to achieve this by the results are not per the requirement. In short I need something like this
The results of recyclerview inside recyclerview is something like this. The items are not stretching to full length as highlighted in yellow.
How can I achieve this? I have user grid layout manager on inner recyclerview with spancount of 3 and tried with 4 as well. Converted to linearlayout manger horizontal but not able to get the desired result.
You can use GridLayoutManager for this. Just call the setSpanSizeLookup method and determine how many columns an item should take.
I got the following recycler view, on the view item there are 5 checkboxes. How could I align the checkboxes inside the recycler view items with the TextView dates on the fragment..?
I tried using the same padding, but different dates got different sizes, as well as phones, so it doesnt display a correct alignment on all instances.. Is there a better way? I would appreciate any kind of indication, this is the last problem so I can publish the application.
You can achieve this in a simple way. Take all the textViews of your fragment inside a linear layout group. And keep the layout_weight similar. Thus the textViews will be equidistant.
Similarly, take the checkboxes in a LinearLayout view group. And keep the layout_weight similar. Thus the textViews will be equidistant.
Ps- check the padding and margin of the items, and adjust accordingly.
A single item in my RecyclerView consists of 3 charts but the last one turns out minuscule. How do I make them all appear their full size/total size bigger than 1 page?
To sum up: 1 item made up of 3 charts. Many such items in a RecyclerView.
Things that I've tried:
1. LinearLayout with equal weights.
2. RelativeLayouts with the heights explicitly mentioned.
Thing I'm trying to achieve:
What I have now:
I looked at MPAndroidChart's example and it uses ListView and not RecyclerView. Thanks in advance!
EDIT:
The answer was Wrapping the entire thing in a ScrollView.
I need to layout a list of five items: 2 on top of the screen, 1 in the middle, 2 on the bottom (basically the green, red, black, orange, and purple squares below, and you can page horizontally through more of these pages):
I am trying to use a RecyclerView with a GridLayoutManager, however I am confused how to set the height of my list_item to be 1/3 the height of the screen (does this involve weight?).
Am I going about this right? Any direction appreciated; I am new to Android dev. Thanks.
Update: I made progress by nesting horizontal linear layouts within one encompassing vertical linear layout. Now I believe I need this to be the list_item, and fill a horizontally-paged list with these items (definitely want to use RecyclerView in conjunction with one of its layout managers.)
You can set span of gridlayout dynamically. Alternatively you can use Lucas Rochas TwoWayView lib which is equipped with different types of layout.
I'm using GridLayoutManager(GLM) in my RecyclerView. In the RecyclerView, I will populate the CardViews, how can I set my GLM to render only one CardView in the whole screen ?
If I set the span size as 1, it renders one CardView per row, not whole screen.
In Simple, I want to show 1 CardView occupying two columns and two rows. How to achieve this ?
Just double the height of the card for it to take the space of 2 rows. The height of each row is dependent on the single item you inflate (in your case a cardView).