最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - Custom Keyboard covering screen, so I'd like to resize it to fit - Stack Overflow

programmeradmin3浏览0评论

I'm using a custom Numeric keyboard extending the BaseKeyboard class on Kotlin. The problem is that the keyboard covers the editText fields when it gets called. I can't use the softkeyboard, cause my app uses a specific design, and I don't want the user to change the keyboard, I want to be the custom by default.

My Keyboard

My xml is a linearLayout inside a relativeLayout, inside a scrollView. The keyboard is a constraintLayout that is Gone until the editText is clicked, making it become visible.

<RelativeLayout xmlns:android=";
xmlns:tools=";
android:layout_width="match_parent"
android:layout_height="match_parent" >

<EditText
    android:id="@+id/edittext0"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:drawableRight="@drawable/hex"
    android:inputType="text" />

<EditText
    android:id="@+id/edittext1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/edittext0"
    android:layout_centerHorizontal="true"
    android:drawableRight="@drawable/txt"
    android:inputType="text" />

...

<android.inputmethodservice.KeyboardView
    android:id="@+id/keyboardview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:visibility="gone" />

I'm using a custom Numeric keyboard extending the BaseKeyboard class on Kotlin. The problem is that the keyboard covers the editText fields when it gets called. I can't use the softkeyboard, cause my app uses a specific design, and I don't want the user to change the keyboard, I want to be the custom by default.

My Keyboard

My xml is a linearLayout inside a relativeLayout, inside a scrollView. The keyboard is a constraintLayout that is Gone until the editText is clicked, making it become visible.

<RelativeLayout xmlns:android="http://schemas.android/apk/res/android"
xmlns:tools="http://schemas.android/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<EditText
    android:id="@+id/edittext0"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:drawableRight="@drawable/hex"
    android:inputType="text" />

<EditText
    android:id="@+id/edittext1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/edittext0"
    android:layout_centerHorizontal="true"
    android:drawableRight="@drawable/txt"
    android:inputType="text" />

...

<android.inputmethodservice.KeyboardView
    android:id="@+id/keyboardview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:visibility="gone" />
Share Improve this question edited Apr 2 at 18:31 anpan A asked Apr 1 at 18:09 anpan Aanpan A 12 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

Have you tried setting android:imeOptions="flagNoFullscreen" in your EditText element?

Also, this post has lots of solutions for this, maybe one of them will help you

Just add android:windowSoftInputMode="adjustPan" in your activity tag in manifest.

        <activity
            android:name=".activity.MainActivity"
            android:windowSoftInputMode="adjustPan"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
发布评论

评论列表(0)

  1. 暂无评论