RelativeLayout content not visible

As shown in the following layout, when there are too many items in the list, there is more than one screen.

I cannot see the following LinearLayout content while dragging.

How to solve this problem?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    </ListView>

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="100dp"
        android:layout_below="@+id/list"
        android:layout_centerHorizontal="true"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/UserIDStatic"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/UserID" />
        .
        .
        .
    </LinearLayout>

</RelativeLayout>

      

Thanks in advance!

0


source to share


2 answers


change to this

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="100dp" >   <!-- use a definate dimension here -->
    </ListView>

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="100dp"
        android:layout_below="@+id/list"
        android:layout_centerHorizontal="true"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/UserIDStatic"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/UserID" />
        .
        .
        .
    </LinearLayout>

</RelativeLayout>

      

either put both ListView

and LinearLayout

inScrollView



or as below comment

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
android:weightSum="1"
android:orientatio="verticle" >

        <ListView
            android:id="@+id/list"
           android:layout_weight="0.5"
            android:layout_width="match_parent"
            android:layout_height="0dp" >  
        </ListView>

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
             android:layout_weight="0.5"


            android:orientation="horizontal" >

            <TextView
                android:id="@+id/UserIDStatic"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/UserID" />
            .
            .
            .
        </LinearLayout>

    </LinearLayout>

      

0


source


There are two options in the image.

  • Instead of a relative layout, use a vertical linear layout with an appropriate list box and internal linear layout (for example, 0.7 and 0.3).
  • Use the same relative layout as above, with an inner LinearLayout for alignparentbottom = true and listview above = "@innerLinearLayout" linearlayout.


This might solve your problem. Using a specific viewing height can cause a different look in the user interface for different screen sizes.

0


source







All Articles