Kshitij Gulati
Kshitij Gulati

Reputation: 19

list view inside relative layout not taking entire screen height

The code is not coming in the full screen...
The size of the list view is not fitting the whole screen.

<RelativeLayout
    android:id="@+id/linearlayoutassigt"
    android:layout_width="250dp"
    android:layout_height="340dp" >

    <ListView
        android:id="@+id/listviewassignments"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="13dp"
        android:background="@drawable/round_bottom"
        android:divider="@android:color/darker_gray"
        android:dividerHeight="0.5dp"
        android:listSelector="#00000000"
        android:padding="10dp"
        android:scrollbarStyle="outsideOverlay"
        >
    </ListView>

    <TextView
        android:id="@+id/emptyText"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:layout_gravity="center_vertical|center_horizontal"
        android:gravity="center_horizontal"
        android:text="@string/ID_NO_ASSIGNMENT_MSG"
        android:textColor="@android:color/black"
        android:visibility="gone" />

    <ProgressBar
        android:id="@+id/progressbarassignmentload"
        style="@android:style/Widget.ProgressBar.Small"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_gravity="center_horizontal|center_vertical" />

    <TextView
        android:id="@+id/student_left_frag_assignment_error_text"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:paddingLeft="10dp"
        android:textColor="@android:color/black" />
</RelativeLayout>

Upvotes: 1

Views: 635

Answers (4)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

Just update your parent layout .

 <RelativeLayout
          android:id="@+id/linearlayoutassigt"
          android:layout_width="match_parent"
          android:layout_height="match_parent" >

=============================================== Try this way..

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">



        <ListView
            android:id="@+id/listviewassignments"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:divider="@android:color/darker_gray"
            android:dividerHeight="1dp"
            android:listSelector="#00000000"
            android:scrollbars="vertical"
            android:smoothScrollbar="true"
            android:scrollbarStyle="outsideOverlay"
            >
        </ListView>

        <TextView
            android:id="@+id/emptyText"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_centerInParent="true"
            android:layout_gravity="center_vertical|center_horizontal"
            android:gravity="center_horizontal"
            android:text="@string/app_name"
            android:textColor="@android:color/black"
            android:visibility="gone" />

        <ProgressBar
            android:id="@+id/progressbarassignmentload"
            style="@android:style/Widget.ProgressBar.Small"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_gravity="center_horizontal|center_vertical" />

        <TextView
            android:id="@+id/student_left_frag_assignment_error_text"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:paddingLeft="10dp"
            android:textColor="@android:color/black" />


</LinearLayout>

If it is not works let me inform

Upvotes: 1

Fahim
Fahim

Reputation: 12358

Change

<RelativeLayout
    android:id="@+id/linearlayoutassigt"
    android:layout_width="250dp"
    android:layout_height="340dp" />

to

<RelativeLayout
    android:id="@+id/linearlayoutassigt"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

Upvotes: 0

Samir Bhatt
Samir Bhatt

Reputation: 3261

You have hard coded your root layout. Please make it match parent.

<RelativeLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content">

Upvotes: 2

Sjd
Sjd

Reputation: 1261

This xml is poorly coded. Post image explaining how the design should look.

TextViews are match_parent so because of z-ordering you are seeing the textView only change to wrap_content. Also there is no relativeness!!!

Upvotes: 0

Related Questions