public Dialog onCreateDialog(int id){
AlertDialog.Builder builder开发者_开发百科=new AlertDialog.Builder(this);
builder.setTitle("PubQuiz");
TextView player = new TextView(this);
player.setText("Player1");
builder.setView(player);
TextView team = new TextView(this);
team.setText("TeamA");
builder.setView(team);
return builder.create();
}
how do I get the second textview to show?
You should create a custom dialog for that. Take a look here: Handling buttons in custom dialogs
public Dialog onCreateDialog(int id) {
AlertDialog.Builder builder=new AlertDialog.Builder(this);
builder.setTitle("PubQuiz");
LinearLayout lay = new LinearLayout(context);
lay.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
lay.setOrientation(LinearLayout.VERTICAL);
TextView player = new TextView(this);
player.setText("Player1");
lay.addView(player);
TextView team = new TextView(this);
team.setText("TeamA");
lay.addView(team);
builder.setView(lay);
return builder.create();
}
Try this
精彩评论