Hiding the android keyboard for EditText

2019-01-25 06:22发布

Whenever I click in the EditText the Android keyboard popup window appears, but I don't want the keyboard to pop up.

I want to permanently hide the android keyboard popup for my current application.

How can I do this?

9条回答
虎瘦雄心在
2楼-- · 2019-01-25 06:47

You may try to fake your EditText with a Button like this:

 <Button
     android:id="@+id/edit_birthday"
     style="@android:style/Widget.EditText"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:hint="@string/hint_birthday"/>
查看更多
贪生不怕死
3楼-- · 2019-01-25 06:49

Try This

 public void disableSoftKeyboard(final EditText v) {
            if (Build.VERSION.SDK_INT >= 11) {
                v.setRawInputType(InputType.TYPE_CLASS_TEXT);
                v.setTextIsSelectable(true);
            } else {
                v.setRawInputType(InputType.TYPE_NULL);
                v.setFocusable(true);
            }
        }
查看更多
Viruses.
4楼-- · 2019-01-25 06:50

In the manifest:

  <activity
        android:name=".YourActivity"
       .
       .
       .
        android:windowSoftInputMode="stateAlwaysHidden" >
   </activity>
查看更多
登录 后发表回答