EditText in the customized dialog in Android cannot pop up the input method solution

1. Unable to pop up the input method:

Before calling the show () method, add an empty EditText with dialog. Setview (New EditText (context)). Because it is a custom alertdialog and has the layout specified by us, setting this will not affect our functions, so we can pop up the input method

2. The input method can pop up, but in order to enhance the user experience, when the dialog contains EditText, the keyboard should pop up automatically while displaying the dialog:

(1) The following methods can be added to the custom dialog:

Where EditText is the view of the input box in the custom dialog

(2) after dialog.show (), this method is invoked to display the input method. Because the dialog interface may not be loaded at the time of the call, the editText may still be empty, so a delayed task is required to delay the display.

The above is the solution that EditText in the customized dialog in Android can't pop up the input method introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>