I have a ListView
static height with the 5th item
. The lines in these item
can be of different lengths and depending on this change the height of the item
. Sometimes it turns out that in the height of the ListView
all 5 item
do not fit and a scroll appears. It is necessary to determine how much item
fit into the specified ListView
size, and the rest not to display.
|
1 answer
Before adding a view to the ListView
you need to call View.measure(int, int)
, in fact it initiates the onMeasure(int, int)
call, by overloading it you can find out the dimensions that the onMeasure(int, int)
will have when it is displayed. Then you have to decide whether to add it to the list or not.
If you do not manually call measure()
then onMeasure
will be called after adding the control, which in this case is not appropriate.
|
TextView
. I have a specific area with a given height to display theseTextView
. the information in theTextView
will load automatically and it turns out that they can swell in height. and now if all these 5TextView
do not fit into my very specified area - will some of them not be displayed? - tim_taller 1:01 pm