我以编程方式添加了按钮具有列表视图的页脚视图。现在我想设置按钮的参数并将按钮重力设置为中心垂直。我按照以下方式做了,但它不起作用。如何实现这个?
    btnMoreUpcomingExits = new Button(this);
    btnMoreUpcomingExits.setText("More Upcoming Exits");
    btnMoreUpcomingExits.setBackgroundResource(R.layout.moreupebtn_widget);
    btnMoreUpcomingExits.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.WRAP_CONTENT, ListView.LayoutParams.WRAP_CONTENT));
    btnMoreUpcomingExits.setTextColor(Color.WHITE);
    btnMoreUpcomingExits.setTypeface(null, Typeface.BOLD);
    btnMoreUpcomingExits.setGravity(Gravity.CENTER_HORIZONTAL);
    btnMoreUpcomingExits.setOnClickListener(btnMoreUpcomingExitsListener);
    getListView().addFooterView(btnMoreUpcomingExits); 
    setListAdapter(new UpcomingExitsResultsListViewAdapter(this));