简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM