相关疑难解决方法(0)

无法在Android Pie的键盘视图中显示弹出窗口

我正在制作一个显示popupWindow语言的键盘。在所有设备上,我都可以popupWindow在键盘外完美显示,但在仅Android Pie中,不能popupWindow在键盘外显示。

candidateView连接蓝牙键盘时,我想在键盘之外显示弹出窗口。

我正在使用此代码

setClippingEnabled(false);
showAtLocation(anchor, Gravity.NO_GRAVITY, x, y);
Run Code Online (Sandbox Code Playgroud)

有人有什么想法吗,这是什么问题?

这是演示应用程序-https: //github.com/priyankagb/andoidpiepopupwindowdemo

看截图

在Android Pie中,您可以在底部看到一小行popupWindow用于语言

左边是馅饼下方,右边是馅饼

android popupwindow android-9.0-pie

14
推荐指数
1
解决办法
322
查看次数

Android自定义键盘 - 预览视图约束到父布局

我创建了一个自定义键盘,它工作正常 - 除了前两行键的预览视图显示不够高.它们的垂直位置受到父布局的约束.

这些屏幕截图说明了问题 - "0"和"8"的预览位置是好的,但对于"5"和"2",它不是:

键'0'的预览显示在按钮上方...

按钮'0'

键'8'的预览也显示在按钮上方...

按钮'8'

但键'5'的预览未显示在按钮上方...

按钮'5'

键'2'的预览未显示在按钮上方...

按钮'2'

如何克服,因此"5"和"2"的预览显示在它们各自键上方相同的距离处,与"0"和"8"相同.

这是我的keyboard.xml ...

<android.inputmethodservice.KeyboardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/keyboard"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:keyPreviewLayout="@layout/keyboard_key_preview" />
Run Code Online (Sandbox Code Playgroud)

这是我的keyboard_key_preview.xml ...

<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:background="@color/keyboard_preview_bg"
    android:textColor="@color/keyboard_preview_fg"
    android:textStyle="bold"
    android:textSize="@dimen/keyboard_preview_text_size" />
Run Code Online (Sandbox Code Playgroud)

这是我的keyboard_numeric.xml布局......

<Keyboard
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:keyWidth="33.33%p"
    android:keyHeight="@dimen/keyboard_key_height"
    android:horizontalGap="@dimen/keyboard_horizontal_gap"
    android:verticalGap="@dimen/keyboard_vertical_gap">
    <Row android:rowEdgeFlags="top">
        <Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left"/>
        <Key android:codes="50" android:keyLabel="2"/>
        <Key android:codes="51" android:keyLabel="3" android:keyEdgeFlags="right"/>
    </Row>
    <Row>
        <Key android:codes="52" android:keyLabel="4" android:keyEdgeFlags="left"/>
        <Key android:codes="53" android:keyLabel="5"/>
        <Key android:codes="54" android:keyLabel="6" android:keyEdgeFlags="right"/>
    </Row>
    <Row>
        <Key android:codes="55" android:keyLabel="7" android:keyEdgeFlags="left"/>
        <Key android:codes="56" android:keyLabel="8"/>
        <Key …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-custom-keyboard

10
推荐指数
2
解决办法
2281
查看次数