使用自定义键盘时将视图推到上方

2023-12-24

我为我的 Android 应用程序创建了一个自定义键盘。我还禁用了默认的 Android 键盘。我将键盘显示为活动中的片段,并且显示得很好。

当键盘显示时,我只能将活动视图推到上方。有什么办法可以让我做到这一点吗?

XML FILE

<FrameLayout
        android:id="@+id/flKeyboard"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" />

显示片段

FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.add(R.id.flKeyboard, new Keyboard()).commit();

你可以尝试这样的事情:

<RelativeLayout>  
<View
    android:id="@+id/myView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
 />  
<FrameLayout
        android:id="@+id/flKeyboard"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/myView"
/>

</RelativeLayout>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用自定义键盘时将视图推到上方 的相关文章

随机推荐