I'm trying to add a button after ListView
in a custom Dialog
using addFooterView()
method. birthday_friend_contact_dialog.xml
code..
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="#FFFFFF"
android:layout_height="wrap_content" >
<ListView
android:id="@+id/friend_contact_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:dividerHeight="1dp" />
birthday_footerview_button.xml
..
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/birthday_friend_footer_button"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content" >
<Button
android:id="@+id/cancel_contact_dialog"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Cancel" />
adding Button
in custom Dialog
below ListView
using the following code..
final Dialog dialog = new Dialog(AddNewFriend.this);
dialog.setContentView(R.layout.birthday_friend_contact_dialog);
dialog.setTitle("Select Contact...");
ListView contactList = (ListView) dialog
.findViewById(R.id.friend_contact_list);
//////Some code for listview adapter
View footerLayout = (View)dialog.getLayoutInflater().inflate(R.layout.birthday_footerview_button,null);
Button dialogButton = (Button) footerLayout
.findViewById(R.id.cancel_contact_dialog);
contactList.addFooterView(footerLayout);
dialog.show();
But Button
doesn't appear below ListView
.
Thanks in advance.