开发者

Maximum item length in Android listview?

开发者 https://www.devze.com 2023-03-16 13:13 出处:网络
In an Android ListView, is there a maximum length that a node in the ListView can ha开发者_如何学编程ndle?

In an Android ListView, is there a maximum length that a node in the ListView can ha开发者_如何学编程ndle?

I am inflating an XML-file into a ListView, and in certain cases, the data coming into it may be rather large...

I could perhaps truncate the data and allow the user to click on the item and bring up the full text in a separate view, but what is the max length it can handle?


The ListView is populated in the memory of the device. In your ListAdapter-class you specify the input for the list.

I can only guess but I think, for one item, it can print as much as a String can hold. Depending on how many full Strings can be placed in the Memory of your Device/Emulator, you'll get some kind of Overflow I guess.

But a ListView is meant to show a lot of short data and redirect to the full data (like you said with the extra Activity). Also I don't think this will look good at all.


As far as I know, there is no hard limit for maximum text lenght in ListView. But you are limited by device resources (memory, cpu, etc.).

From UX point of view, it is not good idea to place long text in ListView. Make your users happy and split it to list=>detail.

0

精彩评论

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