In Android ListActivity, how do you apply layout formatting to footers?
        Posted  
        
            by johnrock
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by johnrock
        
        
        
        Published on 2010-04-03T14:58:38Z
        Indexed on 
            2010/04/03
            15:03 UTC
        
        
        Read the original article
        Hit count: 327
        
android
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?
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.
Here is the basic code I am working with
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);   
        © Stack Overflow or respective owner