Something is really stupid, but I want to set the maximum height for my list, and I don't seem to find something that works. Some talk about setting maxheight for a list, but I canβt find this option? Now i have
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="40dp" > <ListView android:id="@+id/lvSwitch" android:layout_width="fill_parent" android:layout_height="120dp" > </ListView> </LinearLayout>
But when there is only one element in the list, it still has a height of 120dp, which, of course, is not necessary, it simply can not exceed this height ...
source share