android - EditText doesn't work inside AlertDialog v7 -
i using alertdialog v7 create custom dialog. inside custom view have edittext inputtype "phone|numberpassword". in case when try type text - doesn't work, mean edittext doesn't show changes, new symbols...
here custom view alertdialog:
<linearlayout android:id="@+id/ll_login_reglayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:visibility="visible" android:paddingright="@dimen/dialog_padding" android:paddingleft="@dimen/dialog_padding" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <edittext android:id="@+id/et_p1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputtype="phone|numberpassword" /> </linearlayout>
here example of code inside fragment:
private void showsetpassdialog(){ alertdialog.builder builder = new alertdialog.builder(getactivity()); view dialogview = layoutinflater.from(getactivity()).inflate(r.layout.dialog_register_pass, null); builder.setview(dialogview); builder.setpositivebutton(getstring(r.string.text_dialogpsw_btn_ok_password), new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { if (!chb.ischecked()) { string mess = getstring(r.string.error_check_dogovor); su_tools.showtoast(getactivity(), mess); showsetpassdialog(); } else { mmainlayout.setvisibility(view.visible); } } }); builder.show(); }
you need break how set dialog. try this:
alertdialog alert = new alertdialog.builder(this) .setview(dialogview) .setpositivebutton(getstring(r.string.text_dialogpsw_btn_ok_password), null) .create(); alert.setonshowlistener(new dialoginterface.onshowlistener() { @override public void onsow(dialoginterface dialoginterface) { final button button = alert.getbutton(alertdialog.button_positive); button.setonclicklistener(your code here); } }); alert.show();
Comments
Post a Comment