In Android ListActivity, how do you apply layout formatting to footers?
<p>In an Android ListActivity, I am adding a button as a footer in a ListView.  How can I apply layout formatting to this button like centering it and/or width=fill_parent?</p>

<p>I have tried a few things such as using setLayoutParams(), but have not gotten it to work - the footer always disappears when I try anything.</p>

<p>Here is the basic code I am working with</p>

<pre><code>closeButton = new Button(this);
closeButton.setText(getResources().getString(R.string.title_closeprocess));
closeButton.setOnClickListener(new OnClickListener(){
        public void onClick(View v) {               
            closeProcess();
        }

   });

getListView().addFooterView(closeButton);   
</code></pre>

<p>*update</p>

<p>Based on Christopher's answer, here is the footer view that I am adding to my listview, and the activity code that adds it to the listview:  </p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/closebutton_layout"    
android:layout_width="fill_parent"
android:layout_height="wrap_content"&gt;

&lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toptable" 
    android:layout_width="fill_parent"
    android:stretchColumns="*" 
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true" 
    android:layout_height="wrap_content"&gt;
    &lt;TableRow&gt;          
        &lt;Button android:id="@+id/closebutton" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:text="Skip Question"
        android:gravity="center" 
        android:paddingTop="16dip"&gt;
    &lt;/Button&gt;           
    &lt;/TableRow&gt;         
&lt;/TableLayout&gt;
&lt;/RelativeLayout&gt;



ListView listView = getListView();

    closeButtonView = getLayoutInflater().inflate(R.layout.closebutton_layout, listView, false);
    closeButton = (Button)closeButtonView.findViewById(R.id.closebutton);       
    closeButton.setOnClickListener(new OnClickListener(){
        public void onClick(View v) {
            closeQuestion();                
        }

    });
listView.addFooterView(closeButtonView);
</code></pre>
