我的代码(和更多):我有一个协调布局,如下所示
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapse_toolbar"
android:layout_width="match_parent"
android:layout_height="280dp"
android:fitsSystemWindows="true"
app:contentScrim="@color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<include layout="@layout/top" /> <!-- A RelativeLayout -->
<android.support.v7.widget.Toolbar
android:id="@+id/MyToolbar"
android:layout_width="match_parent"
android:layout_height="64dp"
app:layout_collapseMode="parallax">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<!-- Main content here -->
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
在框架布局中,我使用一个带有编辑文本的自定义视图,该文本位于底部。编辑文本和自定义视图都显示正常。我在清单文件中定义了android:windowSoftInputMode="adjustResize|stateHidden"。
我的问题是:当点击编辑文本以弹出软键盘时,它会重叠在下方而不是调整FrameLayout大小。我无法让FrameLayout在软键盘弹出时调整大小。任何帮助将不胜感激。
我尝试过的事情:
1. 更新设计支持库至22.2.1 2. 在FrameLayout中添加android:layout_gravity="fill_vertical"属性。
android:fitsSystemWindows="true"
或者window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
上。https://github.com/ksoichiro/Android-ObservableScrollView - Amrut Bidri