class Name extends Activity{
public void onCreate(){
// the OS will inflate the your_layout.xml
// file and use it for this activity
setContentView(R.layout.your_layout);
}
}
Button but = new Button();
but.setText ="button text";
but.background ...
but.leftDrawable.. and so on...
TextView txt = new TextView();
txt.setText ="button text";
txt.background ... and so on...
然后我们必须创建一个布局,我们可以添加上面的视图:
RelativeLayout rel = new RelativeLayout();
rel.addView(but);