Android应用程序中的EditText和键盘

时间:2013-09-04 13:36:34

标签: android android-edittext

我的删除键有问题。

当我向我的应用添加EditText时,我可以写,但我无法删除字符。

有什么问题?

<EditText
                android:id="@+id/typeCode"
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:layout_alignParentTop="true"
                android:layout_marginTop="10dp"
                android:layout_toRightOf="@+id/textView1"
                android:ems="10"
                android:gravity="center"
                android:hint="@string/type_code"
                android:inputType="textNoSuggestions"
                android:imeOptions="actionDone"
                android:lines="1"
                android:maxLength="6"
                android:singleLine="true"
                android:textSize="14sp" />

这是我的问题:

@Override
    public boolean dispatchKeyEvent(KeyEvent event){
        if (event.getKeyCode() == KeyEvent.KEYCODE_BACK){

            alertDialog.show();
        }    
        return false;
    }

更改为:

@Override
    public boolean dispatchKeyEvent(KeyEvent event){
        if (event.getKeyCode() == KeyEvent.KEYCODE_BACK){

            alertDialog.show();
              return false;
        }else{
              return super.dispatchKeyEvent(event);
        }
    }

Tnx,寻求帮助。

0 个答案:

没有答案