R
R
rzr2014-07-08 14:01:26
Android
rzr, 2014-07-08 14:01:26

How to determine the height of a listview element?

The listview has a LinearLayout. It is necessary to define the full height of the LinearLayout, the elements of which are filled dynamically, as a result of which they have different heights. At the moment, the length of all elements of the list is taken to be the same, regardless of the amount of text inside.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Marat S, 2014-07-10
@aratj

View childView = myadapter.getView(index, null, mylistView);
childView.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
height+= childView.getMeasuredHeight();

I think you will go over the elements of the list yourself?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question