【发布时间】:2013-03-23 01:37:44
【问题描述】:
我想添加一组元素(文本框、按钮、进度条和文本视图),并让它们在 Android 中按下按钮时动态显示。在每次按下按钮时,我都想创建一组元素并将它们放在相对布局中。这是我的oncreate 方法:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// The add button to insert new downloading file
add = (Button) findViewById(R.id.button_add_url);
add.setOnClickListener(this);
// Swapping between pause and resume
pause = (Button) findViewById(R.id.button_pause_resume);
pause.setOnClickListener(this);
download = (Button) findViewById(R.id.button_download);
download.setOnClickListener(this);
// The progress is written here
text = (TextView) findViewById(R.id.textView2);
text.setTextColor(Color.WHITE);
progress = (ProgressBar) findViewById(R.id.progressBar1);
}
【问题讨论】:
标签: android