如何在Android中動態添加按鈕?如何在Android中動態添加按鈕?
3 回答
湖上湖
TA貢獻2003條經驗 獲得超2個贊
LinearLayout ll = (LinearLayout)findViewById(R.id.layout);Button btn = new Button(this);btn.setText("Manual Add");
btn.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));ll.addView(btn);- 3 回答
- 0 關注
- 1905 瀏覽
添加回答
舉報
0/150
提交
取消
