android-dialog box pops up EditText cannot bring up input method

Source: Internet
Author: User
Tags set background

Recently the use of dialog Pop-up dialog box function, pop-up after entering the password, this thought this is a very simple problem, but do a good job to find EditText can not recall input method.

Solution, I also found Baidu. Record it for next use:

 final  Dialog alertdialog = new         Dialog (this  ,r.style.customdialogstyle);        Alertdialog.show ();        Window window  = Alertdialog.getwindow (); Window.setbackgrounddrawable ( new  colordrawable (0)); //   Window.setcontentview (        R.layout.dialog_info);  final  EditText pwd = (EditText)        Window.findviewbyid (R.ID.PWD);        Button confirm  = = (Button) Window.findviewbyid (R.id.btn_cancel); 
Below is the BTN monitoring ... Omit

Above create a dialog box, use a style as follows Customdialogstyle:

 <stylename= "Customdialogstyle"Parent= "@android: Style/theme.dialog">        <Itemname= "Android:windowframe">@null</Item>        <Itemname= "Android:windowisfloating">True</Item>        <Itemname= "Android:windowistranslucent">True</Item>        <Itemname= "Android:windownotitle">True</Item>        <Itemname= "Android:background">@android: Color/transparent</Item>        <Itemname= "Android:windowbackground">@android: Color/transparent</Item>        <Itemname= "android:backgrounddimenabled">True</Item>        <Itemname= "Android:backgrounddimamount">0.6</Item>    </style>

dialog box layout is very simple, I omitted, writing is also more ugly, inside a EditText, 2 button

There is also a way to create a dialog box:

Final Alertdialog Alertdialog = new Alertdialog.builder (this). Create ();
This is also a way I often use, generally I used to display some information, do not enter content. Last one, though it's ugly.



android-dialog box pops EditText cannot bring up IME

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.