EditText in Android development alertdialog The problem-solving method of input method

Source: Internet
Author: User

Code:

The code is as follows Copy Code

Dialog ad = new Dialog (context);
Ad.show ();
window window = Ad.getwindow ();
Window.setbackgrounddrawable (new colordrawable (0));
Window.setcontentview (R.layout.cancel_sos_dialog);

The best approach is the second:

The code is as follows Copy Code
Alertdialog ad = new Alertdialog.builder (context). Create ();
Ad.setview (Managerdialoglayout_.build (Context,ad));
Ad.show ();
window window = Ad.getwindow ();
Window.setcontentview (Managerdialoglayout_.build (Context,ad));

Call Setview (layout) before calling the Show method, show and then call Window.setcontentview (layout), and two layout layouts should be the same.
As for the reason, temporarily unknown, but did solve the problem, click on the EditText, you can call the soft keyboard, input method.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.