I would like to add an ImageView under my ListView in my ListActivity. So that when the user scrolls to the end of the list, the ImageView shows.
I can't seem to get my layout correct. Either the ImageView is not displayed at all, or if I use layout_weights, then both the ListView and ImageView get 50% of the screen. Any ideas how I can get what I want? Thanks.
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/android:empty"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/list_no_items" />
<ImageView
android:id="@+id/instruct_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/instructions"/>
</LinearLayout>
Unfortunately I don't think what you want to accomplish is easily done with standard Android layouts. You can't have a
ListViewwithin anotherScrollView.You could use the
ListViewfooter to position theImageViewbelow the ListView.Or, you could try to add the
ImageViewas the last row in the ListView. To do this, override thegetViewmethod of the adapter and return theImageViewif it is the last row.