0

I know listview in listview have height issue with wrap_content property not working.

I use this code to fix my code, but it doesn't work.

This is my logcat. (when i scrolled my parent listview)

I have 3 listview, so it indicate level 0, level 1, level 2.
add {number} indicate " added item's height is {number} "

12-22 21:13:57.368 - ~~~~~ : this is level of 0
12-22 21:13:57.372 - ~~~~~ : add 857
12-22 21:13:57.375 - ~~~~~ : add 2159
12-22 21:13:57.378 - ~~~~~ : add 1109
12-22 21:13:58.569 - ~~~~~ : this is level of 1
12-22 21:13:58.597 - ~~~~~ : add 1109
12-22 21:13:58.602 - ~~~~~ : add 1088
12-22 21:13:58.606 - ~~~~~ : add 1895
12-22 21:13:58.608 - ~~~~~ : add 944
12-22 21:13:58.616 - ~~~~~ : add 1349
12-22 21:14:00.244 - ~~~~~ : this is level of 2
12-22 21:14:00.255 - ~~~~~ : add 449
12-22 21:14:00.258 - ~~~~~ : add 584
12-22 21:14:02.168 - ~~~~~ : this is level of 0
12-22 21:14:02.173 - ~~~~~ : add 335
12-22 21:14:02.179 - ~~~~~ : add 581
12-22 21:14:02.186 - ~~~~~ : add 1109
12-22 21:14:05.870 - ~~~~~ : this is level of 1
12-22 21:14:05.876 - ~~~~~ : add 1109
12-22 21:14:05.881 - ~~~~~ : add 1088
12-22 21:14:05.887 - ~~~~~ : add 719
12-22 21:14:05.892 - ~~~~~ : add 944
12-22 21:14:05.897 - ~~~~~ : add 503
12-22 21:14:07.123 - ~~~~~ : this is level of 2
12-22 21:14:07.128 - ~~~~~ : add 449
12-22 21:14:07.131 - ~~~~~ : add 584
12-22 21:14:08.799 - ~~~~~ : this is level of 0
12-22 21:14:08.811 - ~~~~~ : add 335
12-22 21:14:08.818 - ~~~~~ : add 581
12-22 21:14:08.824 - ~~~~~ : add 1109

but I have exactly same height's item. (57dp)

what is my problem..??

now, i just use below code to solve this problem.

// params = listView.layoutParams, metrics = DisplayMetrics()
params.height =
    (57*metrics.density*adapter.count + listView.dividerHeight * (adapter.count - 1))
listView.layoutParams = params
listview.requestLayout()

It can't work at various height. this is not cool

mgcation
  • 517
  • 6
  • 17

0 Answers0