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();
}
如何显示第二个textview?
答案 0 :(得分:0)
您应该为此创建自定义对话框。看看这里:Handling buttons in custom dialogs
答案 1 :(得分:0)
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();
}
试试这个