Я хочу реализовать диалоговое окно для ввода пароля и проверки его. Теперь я определил класс диалога, а функция oncreate будет устанавливатьContentView, используя мой собственный файл макета.Как добавить слушателя в edittext в пользовательский диалог
MyDialog class {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setContentView(R.layout.ms_pdf_viewer_password_layout);
}
}
Вот XML
<EditText
android:imeOptions="actionGo"
android:layout_marginLeft="4dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:textColorHint="@color/hint_text_color"
android:textColor="@color/text_color"
android:textSize="12dp"
android:hint="Please enter the password"
android:ems="10"
android:id="@+id/editText"/>
создать объект диалога во фрагменте, и я хочу, чтобы обрабатывать кнопку ввода прессовое и проверки ввода пароля, но слушатель не работает, ActionId не может быть распечатанный. Я думаю, что, возможно, я не получу объект editText правильно.
Dialog dialog = new PdfPasswordDialog(getActivity());
View view = inflater.inflate(R.layout.ms_pdf_viewer_password_layout, container, false);
EditText editText = (EditText) dialog.findViewById(R.id.editText);
editText.setOnEditorActionListener(
new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
Log.i(sClassTag,"actionID is "+actionId);
Как добавить слушателя в edittext в пользовательский диалог для ввода пароля? Любая помощь приветствуется.
вы можете использовать 'TextWatcher' –