-2

I am getting scroll in list view in even though there is enough space below list view. height is WRAP_CONTENT. I will not able to give it fill_parent or match_parent due to my design.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white" >

    <RelativeLayout
        android:id="@+id/header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/header_back_blue"
        android:gravity="center_vertical"
        android:padding="10dp" >

        <ImageView
            android:id="@+id/first_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true" />

        <TextView
            android:id="@+id/header_title_text"
            style="@style/headerBlueText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="Home" />

        <ImageView
            android:id="@+id/last_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:onClick="openSettings"
            android:src="@drawable/settings_icon" />
    </RelativeLayout>

    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/header"
        android:background="@android:color/transparent" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >

            <FrameLayout
                android:layout_width="fill_parent"
                android:layout_height="0dip"
                android:layout_weight="1"
                android:background="@color/listview_back_grey" >

                <RelativeLayout
                    android:id="@+id/rl_settings"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:background="@color/settings_bg"
                    android:visibility="gone" >

                    
                    <!-- Here I am getting scroll -->
                    <ListView
                        android:id="@+id/setting"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_alignParentTop="true"
                        android:background="@color/white"
                        android:divider="@color/settings_divider"
                        android:dividerHeight="2dp"
                        android:paddingLeft="15dp"
                        android:paddingRight="15dp" >
                    </ListView>
                </RelativeLayout>

                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:visibility="visible" />
            </FrameLayout>

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="0"
                android:background="@android:color/transparent"
                android:divider="@null" />
        </LinearLayout>
    </TabHost>

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:background="@android:color/transparent"
        android:onClick="openAddNewTask"
        android:src="@drawable/center_circle" />

</RelativeLayout>

Sorry, i cant share image due to less reputation

Arth Tilva
  • 2,496
  • 22
  • 40

1 Answers1

1

you shouldn't be using wrap_content for your listview. you probably should change something about your layout. Perhaps use weight to get the desired size, like suggested here: https://stackoverflow.com/a/7588931/4498224 and here https://stackoverflow.com/a/11295287/4498224

If you don't want your list to scroll at all, you probably shouldn't be using a list. Maybe try to use a linearlayout and fill it in in your code.

Community
  • 1
  • 1
SnyersK
  • 1,296
  • 8
  • 23