开发者

Android: Disable SoftKeyboard in MultiLine EditText

开发者 https://www.devze.com 2023-03-15 07:57 出处:网络
Need some help to enable multiple lines i开发者_JAVA百科n EditText WITHOUT permiting softkeyboard to open.

Need some help to enable multiple lines i开发者_JAVA百科n EditText WITHOUT permiting softkeyboard to open.

I DON'T use android's native softkeyboard. I have my own "softkeyboard" as a view inside activity.

I've tried these solutions, but they DID NOT WORK:

  • Disable SoftKeyboard in MultiLine EditText android

  • how to block virtual keyboard while clicking on edittext in android?

  • (Similar) EditText with textPassword inputType, but without Softkeyboard


This solution works fine for Android 2 but doesn't work for SOME Android 4 phones (And I don't really know why):

<EditTextExtension
a:editable="false"
a:singleLine="false"/>

Class EdiTextExtension should override onCheckIsTextEditor() method:

@Override
public boolean onCheckIsTextEditor() {
    if ( Build.VERSION.SDK_INT >= 11 ) {
        // resulting false for Android >= 11 will hide cursor
        // NOTE: this code works fine only with SOME devices and not all (WHY?)
        return true;
    } else {
        return false;
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消