当用户单击按钮时,我的应用程序应该显示三个按钮。我该怎么做?动态布局是否可以帮助我做到这一点?
或者如果有另一种方法可以做到这一点,请建议我。
public class MainActivity extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ParseAnalytics.trackAppOpened(getIntent());
}
public void addListenerOnButton() {
//Select a specific button to bundle it with the action you want
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent openBrowser = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.mechmerize.com"));
startActivity(openBrowser);
}
});
Button button1 = (Button) findViewById(R.id.button3);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
}
}
当用户单击按钮时,我需要显示三个按钮3