横向模式下键盘顶部的自定义工具栏

时间:2016-10-24 18:42:29

标签: android android-softkeyboard landscape

我有一个位于键盘顶部的自定义工具栏,允许用户选择EditText视图的选项。这在纵向模式下工作正常,但我需要它在横向模式下工作。截至目前,我的AndroidManifest用于活动

    <activity
        android:name="MyActivity"
        android:windowSoftInputMode="stateHidden|adjustResize" />

这是XML布局

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

<!-- some content, including an edit text -->

<!-- my toolbar that is supposed to sit on top of the keyboard -->
    <HorizontalScrollView
        android:id="@+id/custom_toolbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_height="@dimen/toolbar_height"
        android:layout_alignParentBottom="true" />

如上所述,这是纵向工作,但当我将方向切换到横向时,我只看到通常的键盘,我的自定义工具栏不存在

自定义工具栏应该位于键盘顶部,但它不是。 enter image description here

1 个答案:

答案 0 :(得分:0)

您可以为android:imeOptions="flagNoExtractUi"设置EditText,以防止切换到全屏输入模式。