目前很多的输入法都有自动提示补全功能,在一些应用场景里不适用,需要禁用系统输入法,自定义软键盘,EditText的光标问题是比较头疼的,网上的说法很多,然而大部分都是解决不了问题的。以下是本人做的一个demo供网友参考。

直接上代码:

xml软键盘:

        <android.inputmethodservice.KeyboardView
            android:id="@+id/keyboard_view"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@color/white"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:keyBackground="@drawable/btn_keyboard_key"
            android:keyTextColor="@color/black"
            android:visibility="gone" />

禁用系统输入