简体   繁体   English

如何在Recyclerview中始终显示完整的项目而不是项目的一部分?

[英]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! 我是Android开发的新手,我有Recyclerview,并且我希望它在更改屏幕大小时始终显示完整布局的项目,而不是项目的一部分!

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 ! 说我有一个Recyclerview,当我更改屏幕较小的设备(例如,新设备的屏幕尺寸为XXhdpi)时,它在XXXhdpi中垂直显示3个项目,recyclerview显示2个项目和第3个项目的一部分,您必须滚动查看整个项目...如何避免此问题,并始终显示3个项目或2个项目! 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. 如果屏幕可以容纳2个项目,则不应显示第3个项目,并且出现的2个项目应具有更大的宽度和高度以适合屏幕,并隐藏第3个项目的空间。

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. 假设single_row.xmlsingle_row.xml中重复的布局,您将必须为各种屏幕尺寸创建单独的single_row.xml布局。 And they will be accordingly used during the onCreateViewHolder 并且它们将在onCreateViewHolder期间相应地使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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