Dynamically adjust the height of group headers in an ExpandableListView
I have an ExpandableListView (ELV) with the groups having LinearLayout. I have set the height of the group to some value (38dip in this case, equivalent to two lines of text). If the group heading is long and would take more than 2 lines, it is not shown properly in the ELV item - some part of the view gets scrolled. On the other hand, if I change android:layout_height to "wrap_content" in the LinearLayout, the groups always show all the lines. But the line widths are variable, ie, short titles show up with only 1 line and long titles show up with 2, 3 or 4 lines. That looks ugly. I would like to implement the height to be something like max("38dip", "wrap_content"). Is there a way to do this?
Even programmatically, I do not seem to be getting the actual height of the group if I set android:layout_height to "wrap_content". Any suggestions there?
Could not solve the problem directly. Added the following to the xml layout file of the group:
android:paddingTop="7dip"
android:paddingBottom="7dip"
That makes the layout looking much less congested which is what I wanted to do in the first place. Moving on - but would be interested if someone else have a better solution.
链接地址: http://www.djcxy.com/p/93240.html上一篇: 父母和填写内容