i have a problem with a listView that is shown deep under many layers of other layouts.
here the code.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost
android:layout_width="fill_parent"
android:id="@android:id/tabhost"
android:layout_weight="12"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/linearLayout1">
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout5"
android:gravity="top"
android:layout_weight="1">
<ScrollView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/scrollView1"
android:scrollbars="none">
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/linearLayout2">
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout3">
<TextView
android:text="@string/UTlbEqID"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lbEqID" />
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lbEqIDVar"
android:layout_marginLeft="15dp"
android:hint="wie sieht dass denn aus?" />
<TextView
android:text="@string/UTlbEqDesc"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lbEqDesc"
android:layout_marginTop="5dp" />
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lbEqDescVar"
android:layout_marginLeft="15dp"
android:hint="wie sieht dass denn aus?" />
<TextView
android:text="@string/UTlbTaskID"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lbTaskID"
android:layout_marginTop="5dp" />
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lbTaskIDVar"
android:layout_marginLeft="15dp"
android:hint="wie sieht dass denn aus?" />
<TextView
android:text="@string/UTlbTaskDesc"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lbTaskDesc"
android:layout_marginTop="5dp" />
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lbTaskDescVar"
android:layout_marginLeft="15dp"
android:hint="wie sieht dass denn aus?" />
<TextView
android:text="@string/UTlbTaskDate"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lbTaskDate"
android:layout_marginTop="5dp" />
<TextView
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lbTaskDateVar"
android:layout_marginLeft="15dp"
android:hint="wie sieht dass denn aus?" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/linearLayout4">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom" />
</LinearLayout>
</TabHost>
</LinearLayout>
well, the exact code of the listview, shwon via the tabcontent is this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:isScrollContainer="true">
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/linearLayout1"
android:layout_marginTop="20dp">
<LinearLayout
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:id="@+id/linearLayout2"
android:layout_height="57dp">
<Button
android:text="@string/EmpTbtnEmploAdd"
android:id="@+id/btnEmploAdd"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1" />
<Button
android:text="@string/EmpTbtnEmploDel"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="@+id/btnEmploDel"
android:layout_weight="1" />
</LinearLayout>
<ListView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:id="@+id/lvEMPT"
android:layout_height="162px"
android:scrollbars="vertical"
android:isScrollContainer="true"
android:divider="@android:color/darker_gray"
android:dividerHeight="1px" />
</LinearLayout>
</LinearLayout>
my problem is, that this list won’t expand itself neither to the parent if i set its height attribute to fill_parent or match_parent nor to the size of all its items. it won’t even scroll whatever i do. The only thing it does ist responding to an click event, at least the only item shown(of 10) is getting hilightend blue (seems to be the main colour of an sgs+) as i click it, but there is no code behind that yet.
the list should resize itself at least to parent or to the number of items it has, up to a certain point, where it should be scrollable then.
how is it possible to get that thing work that way?
ps: you may wonder about the 162px, i tried to resize that damn thing by code but the height attribute is read only…
You are using
ListViewinsideScrollView.ListViewcan’t be used in such way.By the way, your layout is extremely inefficient – nested layouts are bad for perfomance. Consider using
RelativeLayoutinstead of multipleLinerLayout