проблема диалогов - PullRequest
       4

проблема диалогов

0 голосов
/ 28 апреля 2011
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();

       }

как мне получить второе текстовое представление для показа?

Ответы [ 2 ]

0 голосов
/ 28 апреля 2011
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();
}

Попробуйте это

0 голосов
/ 28 апреля 2011

Вы должны создать собственный диалог для этого. Взгляните сюда: Работа с кнопками в пользовательских диалогах

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...