Coordinatorlayout adjustresize 不起作用 [英] Coordinatorlayout adjustresize not working

查看:27
本文介绍了Coordinatorlayout adjustresize 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码(以及更多):我有一个协调器布局如下

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

我尝试过的事情:

  1. 将设计支持库更新至 22.2.1
  2. 在 FrameLayout 中添加了 android:layout_gravity="fill_vertical" 作为属性.

推荐答案

这只是另一个 错误,看起来他们不打算很快修复它:

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"EditText 添加到 CoordinatorLayout.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆