how to put a button at the end of ExpandableListview dynamically in android
In my application i have an activity which extends ExpandableListActivity, there i want to put a button at the end of ExpandableListview, so that if i exapand it s开发者_运维技巧hould be at the end of listview.
The problem is after exapanding all the items in Expandablelistview it takes the full screen and the button does not appear. How can I scroll button with ExpandableListview? I also tried to give Scrollview but its not working. Give me a way what should I write in xml file for proper o/p. Thank you
Create a footerview layout
consisting of Button
that you want to set as footer and then try
View footerView = ((LayoutInflater)ActivityContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.footer_layout, null, false);
ListView.addFooterView(footerView);
Footer_layout xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="7dip"
android:paddingBottom="7dip"
android:orientation="horizontal"
android:gravity="center">
<LinearLayout
android:id="@+id/footer_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:layout_gravity="center">
<Button
android:id="@+id/footer_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dip">
</Button>
</LinearLayout>
</LinearLayout>
精彩评论