软键盘弹出遮挡EditText并上推ActionBar问题求助
软键盘弹出遮挡EditText并上推ActionBar的解决疑问
我碰到个棘手的问题——点击EditText弹出软键盘时,不仅会遮挡住EditText的一小部分,还会把ActionBar向上顶起来。我已经试过了adjustResize、adjustPan、adjustResize|adjustPan这些windowSoftInputMode参数,也在AppBar里设置了fitsSystemWindows="true",还给Toolbar加了app:layout_collapseMode="pin",但全都不管用。现在这个布局是放在Fragment里的,我到底应该修改Fragment的布局,还是修改承载它的Activity(容器)布局呢?
状态截图
- 正常状态:

- 异常状态:

- 点击表情时正常状态:

Activity布局代码
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:windowSoftInputMode="adjustResize" android:fitsSystemWindows="true"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:id="@+id/toolbar" android:layout_height="@dimen/abc_action_bar_default_height_material" app:layout_collapseMode="pin" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:titleTextAppearance="@style/ToolbarTitleAppearance" app:subtitleTextAppearance="@style/ToolbarSubtitleAppearance" android:background="#2d5d82"/> </android.support.design.widget.AppBarLayout> <include layout="@layout/principal_chat_amigos_container_fragment"/> </android.support.design.widget.CoordinatorLayout>
内容的提问来源于stack exchange,提问作者Lucas Bergamo
相关产品推荐
相关产品推荐

