Relativelayout Content Can Not Be Seen
Like the following layout shows, when the items in list are too much, more than one screen. I can not see the following LinearLayout content when I drag down. How to solve this p
Solution 1:
change to this
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent" ><ListViewandroid:id="@+id/list"android:layout_width="match_parent"android:layout_height="100dp" ><!-- use a definate dimension here --></ListView><LinearLayoutandroid:id="@+id/linearLayout1"android:layout_width="wrap_content"android:layout_height="100dp"android:layout_below="@+id/list"android:layout_centerHorizontal="true"android:orientation="horizontal" ><TextViewandroid:id="@+id/UserIDStatic"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/UserID" />
.
.
.
</LinearLayout></RelativeLayout>
or else put both ListView
and LinearLayout
in ScrollView
or as bellow comment
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:weightSum="1"android:orientatio="verticle" ><ListViewandroid:id="@+id/list"android:layout_weight="0.5"android:layout_width="match_parent"android:layout_height="0dp" ></ListView><LinearLayoutandroid:id="@+id/linearLayout1"android:layout_width="wrap_content"android:layout_height="0dp"android:layout_weight="0.5"android:orientation="horizontal" ><TextViewandroid:id="@+id/UserIDStatic"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/UserID" />
.
.
.
</LinearLayout></LinearLayout>
Solution 2:
There are two options comes in picture.
- Instead of Relative layout Use Vertical Linear layout with appropriate wieght to listview and inner linear layout (eg. 0.7 and 0.3)
- Use same Relative layout as above with inner LinearLayout to alignparentbottom = true and listview above="@innerLinearLayout" linearlayout.
This might solve your problem. Using specific height for listview might cause different look in UI for different sized screens.
Post a Comment for "Relativelayout Content Can Not Be Seen"