开发者

How to make Android gallery display a minimum amount of items?

开发者 https://www.devze.com 2023-04-13 05:36 出处:网络
So I am trying regardless of screen size make an Android gallery display at least 2 items. On large screens this isn\'t an issue because I have plenty of space to display several item.

So I am trying regardless of screen size make an Android gallery display at least 2 items.

On large screens this isn't an issue because I have plenty of space to display several item.

For small screens I would like to be able to have a minimum am开发者_运维技巧ount of items displayed.


Two ways of doing this:

1) Create a layout-ldpi folder and place the desired layout for small screens in there.

2) Check the density and change the layout at runtime:

density = getResources().getDisplayMetrics().density;

If it's small screens (LDPI for example), use another XML layout only displaying "a minimum amount of items".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号