如何在Android中动态添加按钮?

如何在Android中动态添加按钮?
Button myButton = new Button(this);
myButton.setText("Push Me");

LinearLayout ll = (LinearLayout)findViewById(R.id.buttonlayout);
LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
ll.addView(myButton, lp);

看看this的例子

http://stackoverflow.com/questions/1851633/how-to-add-a-button-dynamically-in-android

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:如何在Android中动态添加按钮?