How to add TextView and EditText using default AlertDialog programmatically

前端 未结 3 1435
别跟我提以往
别跟我提以往 2021-02-14 13:51

I\'ve been trying to add two elements in a default AlertDialog but I can\'t seem to make it work. Here\'s my code:

// START Dialog
    AlertDialog.Builder alertD         


        
3条回答
  •  余生分开走
    2021-02-14 14:24

    When calling setView() the original TextView holding the message gets hidden. You need to

    • create a small layout xml and put the EditText and a TextView to it
    • inflate the layout
    • get references of the views with findViewById()
    • do something with the views

提交回复
热议问题