I want to set the ListView height to auto means as per my items will add to listview then at that time height will also increase auto automatically.
<ScrollView
android:id="@+id/abcd_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/profile_layout"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="@drawable/blur_default_img">
<RelativeLayout
android:id="@+id/profile_img_rt"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:gravity="center"
android:background="@drawable/circle_white_bg">
<com.example.RoundedImageView.RoundedImageView
android:id="@+id/profile_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/person_avatar" />
</RelativeLayout>
</RelativeLayout>
<ListView
android:id="@+id/tab_pending_list"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:layout_below="@+id/profile_layout">
</ListView>
</LinearLayout>
</ScrollView>
so this the xml please kindly go through it and suggest me solution that how to increase the height of the listview automatically.
The ListView
is a scrollable view so you should never put it inside another scrollable view like a ScrollView
.
The ListView
will display only the row describe by the adapter behind it. So all you need to do is to just delete the ScrollView
and keep the ListView
with android:height=wrap_content