Custom ListView inside a dialog in android

前端 未结 3 1514
北荒
北荒 2021-01-26 13:03

I am trying to make a custom dialog with listview which is going to contain checkboxes and textviews and i just couldnt find a reasonable tutorial to do it , any help or hints w

3条回答
  •  没有蜡笔的小新
    2021-01-26 13:58

        ListView myList = new ListView(Activity.this);
        myList.setAdapter(adapter);
    
        AlertDialog.Builder builder = new AlertDialog.Builder(Activity.this);
        builder.setView(myList);
        Dialog d = builder.create();
        d.show();
    

    you can specify the textviews and checkboxes and whatever else in the adapter.

提交回复
热议问题