代码之家  ›  专栏  ›  技术社区  ›  Prabhat

如何为特定的EditText禁用硬件键盘?

  •  0
  • Prabhat  · 技术社区  · 15 年前

    你好。。这是我的xml代码

    <EditText android:longClickable="false"
                        android:layout_marginLeft="5dp" android:id="@+id/txt"
                        android:width="150dp" android:singleLine="true" android:text="@string/value"
                        android:inputType="none" android:cursorVisible="false" />
    

    我在应用程序中手动禁用了软键盘。

    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0);
    

    1 回复  |  直到 15 年前
        1
  •  0
  •   Kevin King    15 年前