CoordinatorLayout AdjustResize不起作用 [英] Coordinatorlayout adjustresize not working
问题描述
我的代码(以及更多): 我有一个如下的协调器布局
MY CODE (and more): I have a Coordinator Layout as follows
<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>
在框架布局内部,我使用位于底部的编辑文本来扩展自定义视图.编辑文本和自定义视图显示正常.
Inside the frame layout I am inflating a custom view with an edit text which is placed at the bottom. The edit text and custom view show up fine.
我在清单中定义了android:windowSoftInputMode ="adjustResize | stateHidden".
I have defined android:windowSoftInputMode="adjustResize|stateHidden" in the manifest.
我的问题: 在点击编辑文本以调出软键盘时,它会覆盖下面的内容,而不是调整FrameLayout的大小.当出现软键盘时,我只是无法调整FrameLayout的大小.任何帮助将不胜感激
MY PROBLEM: While tapping on the edit text to bring up the softkeyboard, it overlaps the content beneath instead of resizing the FrameLayout. I just could not get the FrameLayout to resize when the soft keyboard comes up. Any help will be appreciated
我尝试过的事情:
- 将设计支持库更新为22.2.1
- 将android:layout_gravity ="fill_vertical"添加为FrameLayout中的属性.
推荐答案
这只是另一个错误,看来它们
This is just another bug in the design support lib and it seems they don't plan to fix it any time soon:
已确认,但可能不会很快修复. AdjustResize有一些很好的用例,但是将AppBarLayout与CollapsingToolbarLayout一起使用并不是其中之一.
Confirmed, but probably won't be fixed any time soon. adjustResize has a few good use-cases, but using AppBarLayout with CollapsingToolbarLayout with it is not one of them.
令人不安的是,没有人在开发设计支持库时尝试使用android:windowSoftInputMode="adjustResize"
向CoordinatorLayout
添加EditText
.
It's disturbing that nobody tried to add a EditText
to a CoordinatorLayout
with android:windowSoftInputMode="adjustResize"
while developing the design support lib.
这篇关于CoordinatorLayout AdjustResize不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!