android listview : footer view auto fill parent -
i have listview. set position 20(last position), after want add footer start item last listview bottom. description: http://i.imgur.com/i5dfv.jpg
i have set height footer view. don't.
<?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="10000dp" android:orientation="vertical" > <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:text="footer" android:background="#cf9f99" /> </linearlayout>
listview :
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".demoaddlistviewfooteractivity"> <listview android:id="@+id/list_items" android:layout_width="match_parent" android:layout_height="match_parent"/> </relativelayout>
activity :
layoutinflater inflater = getlayoutinflater(); viewgroup footer = (viewgroup) inflater.inflate(r.layout.footer, listitem, false); arrayadapter adapter = new arrayadapter(this, android.r.layout.simple_list_item_1, numbers); listitem.addfooterview(footer, null, false); listitem.setadapter(adapter); listitem.setselection(20);
can me.
Comments
Post a Comment