【问题标题】:During keyboard display state screen is not scrollable在键盘显示状态屏幕不可滚动
【发布时间】:2018-09-25 07:20:54
【问题描述】:

我从一天开始就卡住了,我尝试了多种方法,但不是屏幕不是自动 我正在使用 parent="@style/Theme.AppCompat.Light.NoActionBar" 主题,但没有奏效。我在清单文件 I 中尝试了以下过程 添加如下

 android:windowSoftInputMode="adjustResize"

我也添加了 FrameLayout 和 ScrollView 作为根布局和子布局 布局,但没有工作。

我在 xml 文件中的代码是

android:id="@+id/root_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:fitsSystemWindows="false">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">        
        <Button
            android:id="@+id/forgot_screen_send_button"
            android:layout_width="100dp"
            android:layout_height="45dp"
            android:layout_marginLeft="30sp"
            android:layout_marginRight="30dp"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="20dp"
            android:layout_gravity="center_horizontal"
            android:background="@drawable/blue_color_bg_rec"
            android:text="Send"
            android:layout_alignParentBottom="true"
            android:textColor="@color/white"
            android:textAllCaps="false"
            android:textSize="18sp"/>
    </LinearLayout>
</LinearLayout>

【问题讨论】:

  • 尝试将根RelativeLayout 设置为ScrollView,然后设置fitsSystemWindows="true" 并删除其中一个LinearLayouts。你不需要两者。

标签: android android-layout scrollview android-xml autoscroll


【解决方案1】:

在你的应用清单中试试这个:在&lt;activity tag&gt; android:windowSoftInputMode="adjustPan"

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.NoActionBar"
            android:windowSoftInputMode="adjustPan">
        </activity>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-04
    • 1970-01-01
    相关资源
    最近更新 更多