协调器布局和内容重叠的工具栏折叠时的行为异常

我正在尝试从电影页面中获取一些细节以使其与工具栏重叠,但是一些极端的情况不断导致重叠的内容在工具栏中间的相下。导致这种情况的最新情况是显示了小吃栏。任何信息都将是有帮助的,因为到目前为止,overlapTop行为非常容易出错,并且难以使用。

编辑:每次加载新电影时,我还使用appBarLayout.setExpanded对其进行扩展。不知道这是否重要。

在此处输入图片说明

在此处输入图片说明

家居布置:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    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:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".ui.home.HomeActivity">

    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/coordinator"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/appBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fitsSystemWindows="true">

            <android.support.design.widget.CollapsingToolbarLayout
                android:id="@+id/collapsingToolbar"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_scrollFlags="scroll|exitUntilCollapsed"
                app:contentScrim="?attr/colorPrimary"
                app:titleEnabled="false"
                android:fitsSystemWindows="true">

                <ImageView
                    android:id="@+id/backdrop"
                    android:layout_width="match_parent"
                    android:layout_height="200dp"
                    android:alpha="0.5"
                    android:contentDescription="@string/backdrop"
                    android:scaleType="centerCrop"
                    android:fitsSystemWindows="true"
                    app:layout_collapseMode="parallax" />

                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    app:layout_collapseMode="pin"/>
            </android.support.design.widget.CollapsingToolbarLayout>
        </android.support.design.widget.AppBarLayout>

        <FrameLayout
            android:id="@+id/frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false"
            app:layout_behavior="@string/scrolling_view"
            app:behavior_overlapTop="80dp"
            />

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:src="@drawable/ic_dice_three_48dp"
            app:layout_anchor="@+id/frame"
            app:layout_anchorGravity="bottom|end"
            />
    </android.support.design.widget.CoordinatorLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:menu="@menu/menu_home_nav"/>
</android.support.v4.widget.DrawerLayout>

电影版式:

<android.support.v4.widget.NestedScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/nested_scroll_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:overScrollMode="never"
    tools:targetApi="lollipop"
    tools:ignore="RtlSymmetry">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <RelativeLayout
            android:id="@+id/content"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingTop="16dp"
            android:visibility="visible">

            <ImageView
                android:id="@+id/poster"
                android:layout_width="98dp"
                android:layout_height="140dp"
                android:layout_marginStart="16dp"
                android:layout_marginEnd="16dp"
                android:contentDescription="@string/poster"
                tools:background="@color/md_white_1000"
                />

            <TextView
                android:id="@+id/title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_toEndOf="@+id/poster"
                android:layout_above="@+id/phrase"
                android:layout_marginStart="16dp"
                android:layout_marginEnd="16dp"
                android:gravity="bottom"
                android:textColor="?attr/titleTextColor"
                android:textSize="24sp"
                android:textStyle="bold"
                android:fontFamily="sans-serif-condensed"
                tools:text="Title"/>

            <TextView
                android:id="@+id/phrase"
                android:layout_width="match_parent"
                android:layout_height="80dp"
                android:layout_marginStart="16dp"
                android:layout_marginEnd="16dp"
                android:layout_toEndOf="@+id/poster"
                android:layout_alignBottom="@+id/poster"
                android:paddingTop="16dp"
                android:gravity="top"
                android:textSize="18sp"
                android:textStyle="italic|bold"
                android:fontFamily="sans-serif-condensed"
                tools:text="Good vs Evil" />

            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="140dp">

                <include layout="@layout/card_movie" />
            </FrameLayout>

        </RelativeLayout>

        <android.support.v4.widget.ContentLoadingProgressBar
            android:id="@+id/loading"
            style="?android:progressBarStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:progressBackgroundTint="@color/md_white_1000"
            android:padding="32dp"
            android:visibility="invisible"
            tools:targetApi="lollipop" />

        <RelativeLayout
            android:id="@+id/error"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:visibility="invisible">

            <TextView
                android:id="@+id/error_message"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:padding="32dp"
                />

            <Button
                android:id="@+id/error_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/error_message"
                android:layout_centerHorizontal="true"
                android:text="@string/recycle"/>
        </RelativeLayout>

    </FrameLayout>

</android.support.v4.widget.NestedScrollView>
塔潘HP

尽管您自己获得了很好的解决方案,但是如果您想了解更多信息并想进一步了解可能发生的这些问题,以及为何协调器布局中发生的这些问题已在此博客文章中进行充分说明,我发现它非常有用所以我建议您阅读它。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

协调器布局和内容重叠的工具栏折叠时的行为异常

来自分类Dev

折叠工具栏在协调器布局中滚动时不会折叠

来自分类Dev

使用浮动动作按钮,同时滑动刷新布局和协调器布局以及工具栏布局行为

来自分类Dev

Android状态栏以协调器布局向上滚动,状态图标与工具栏标题重叠

来自分类Dev

如何使工具栏不与Android中的其他内容重叠?

来自分类Dev

工具栏重叠相对布局

来自分类Dev

在协调器布局中隐藏在工具栏下方的视图

来自分类Dev

Bootstrap v2.3.3导航栏被折叠内容重叠

来自分类Dev

Android:折叠线性布局而不是折叠工具栏

来自分类Dev

即使嵌套滚动视图中没有滚动内容,折叠工具栏布局也会滚动

来自分类Dev

折叠工具栏和DrawerLayout

来自分类Dev

折叠工具栏和DrawerLayout

来自分类Dev

Recyclerview中的Cardview与折叠的工具栏重叠

来自分类Dev

夸大的布局与内容重叠

来自分类Dev

如何在折叠的工具栏布局下添加viewpager和tablayout

来自分类Dev

折叠时折叠工具栏锚定视图被隐藏

来自分类Dev

当折叠的工具栏折叠时,如何更改其颜色?

来自分类Dev

折叠工具栏折叠时隐藏浮动按钮

来自分类Dev

折叠时折叠工具栏锚定视图被隐藏

来自分类Dev

使用折叠的工具栏布局实现RecyclerView

来自分类Dev

如何获得折叠的工具栏布局的最大垂直偏移

来自分类Dev

获取折叠的工具栏布局的标题textview

来自分类Dev

未固定折叠式工具栏布局中的工具栏

来自分类Dev

Android - 无法修复折叠工具栏布局中的工具栏

来自分类Dev

工具栏与坐标布局下的活动重叠

来自分类Dev

在Android布局底部添加工具栏时,滚动行为不起作用

来自分类Dev

工具栏与包含片段的内容(LinearLayout)重叠

来自分类Dev

滚动时内容重叠

来自分类Dev

折叠工具栏和ImageView-工具栏未显示

Related 相关文章

  1. 1

    协调器布局和内容重叠的工具栏折叠时的行为异常

  2. 2

    折叠工具栏在协调器布局中滚动时不会折叠

  3. 3

    使用浮动动作按钮,同时滑动刷新布局和协调器布局以及工具栏布局行为

  4. 4

    Android状态栏以协调器布局向上滚动,状态图标与工具栏标题重叠

  5. 5

    如何使工具栏不与Android中的其他内容重叠?

  6. 6

    工具栏重叠相对布局

  7. 7

    在协调器布局中隐藏在工具栏下方的视图

  8. 8

    Bootstrap v2.3.3导航栏被折叠内容重叠

  9. 9

    Android:折叠线性布局而不是折叠工具栏

  10. 10

    即使嵌套滚动视图中没有滚动内容,折叠工具栏布局也会滚动

  11. 11

    折叠工具栏和DrawerLayout

  12. 12

    折叠工具栏和DrawerLayout

  13. 13

    Recyclerview中的Cardview与折叠的工具栏重叠

  14. 14

    夸大的布局与内容重叠

  15. 15

    如何在折叠的工具栏布局下添加viewpager和tablayout

  16. 16

    折叠时折叠工具栏锚定视图被隐藏

  17. 17

    当折叠的工具栏折叠时,如何更改其颜色?

  18. 18

    折叠工具栏折叠时隐藏浮动按钮

  19. 19

    折叠时折叠工具栏锚定视图被隐藏

  20. 20

    使用折叠的工具栏布局实现RecyclerView

  21. 21

    如何获得折叠的工具栏布局的最大垂直偏移

  22. 22

    获取折叠的工具栏布局的标题textview

  23. 23

    未固定折叠式工具栏布局中的工具栏

  24. 24

    Android - 无法修复折叠工具栏布局中的工具栏

  25. 25

    工具栏与坐标布局下的活动重叠

  26. 26

    在Android布局底部添加工具栏时,滚动行为不起作用

  27. 27

    工具栏与包含片段的内容(LinearLayout)重叠

  28. 28

    滚动时内容重叠

  29. 29

    折叠工具栏和ImageView-工具栏未显示

热门标签

归档