How to always show full items not part of items in Recyclerview? - java

I'm new to android development
I have a Recyclerview and I want it to always show items with full layout not part of the item when screen size is changed!
say I have a Recyclerview that shows 3 items vertically in XXXhdpi when I changed the device with smaller screen (for example the new device's screen size is XXhdpi) the recyclerview shows 2 items and part of the 3rd Item and you have to scroll to see the whole item...
how to avoid this problem and always show the 3 items or maybe 2 items ! what i care about is to always show the whole item that fits in the screen not part of it.
if the screen can fit 2 items then the 3rd item should not be showed and the 2 items that appear should have bigger width and height to fit in the screen and hide the space of the 3rd item.
Thank you.

Let's say single_row.xml is the layout that is repeated in the recylcerview
You will have to create separate single_row.xml layouts for various screen sizes. And they will be accordingly used during the onCreateViewHolder

Related

How to create a grid which you can scroll both vertically and horizontally, which contains random sized elements, and works with recyclerview?

I am a beginner, and i tried to find an answer but everything i found was from 2013 and earlier. I want to create a grid which you can scroll in any direction, (as a zoomed in picture), which contains items of different sizes which are generated randomly, then i want to populate them with a recycler view. I will attach an illustration, maybe you would understand it better.As you can see, the thick outline is the phone screen and whenever you scroll the view, it generates new items which are populated by a recycler view.
I thought of using Google's FlexBox Layout for generating the items but i don't really know how to create that scrollable view. I would literally pay to get this done.
I don't think you can make RecyclerView scroll in Both way. U can Create Nested RecyclerView if that is what you are looking for.

RecyclerView expanding background

I have a RecyclerView in which I add items regularly. I want the background of the RecyclerView to expand while the list of items grows.
For example, if the list has two items and a new one is added, a new part of the background is discovered, and so on...
What I expect
The complete RecyclerView is as in the image below. The user can only see a part of it, but discovers the rest when he/she scrolls up or down (which is why RecyclerView exists, I believe).
Here we can see that the whole background is actually expanding beyond the screen's top and bottom border. So whenever the user scrolls the RecyclerView, the background moves with it (matching the movements of the list).
I'm completely lost with that, do you have any idea how to achieve such a behavior?

Android GridView populate from the bottom

I'm using a GridView, and I want items in the grid to start from bottom left and grow to top. Any suggestions on how I can achieve that?
I tried using this attribute:
android:stackFromBottom="true"
but it doesn't work! What can be done?
I am not sure about GridView,
but in a GridLayout when you set its orientation to vertical. each new view is added vertically.
row count limits the number of views per column.

Recyler view initial position

I am using recylerview to display vertical list of data but when i open my app it is scrolled to last item automatically.How do i change default position of recyclerview?
i think you should set setStackFromEnd=false or setReverseLayout=false
And are you sure that you don't set scrollToPosition(list.size())?

How to control the scroll in horizontal listview?

![enter image description here][1]i have the HorizontalListView.when I swipe the list items. I need only one list item to be displayed on the screen. And for a one swipe i need one list item to be scrolled.
Could anyone pls help me for this
[1]: http://i.stack.imgur.com/iugTg.pngenter code here
If you use this HorizontalListView implementation (https://github.com/dinocore1/DevsmartLib-Android/blob/master/devsmartlib/src/com/devsmart/android/ui/HorizontalListView.java) then you can use scrollTo method
If I understood your requirements correctly, that is, full-width items and sweep to move to next/previous full-width item, you should use e.g. ViewPager instead of HorizontalListView.

Categories