1

我想实现这样的目标。(不是 FAB 或 Snackbar)。如何创建布局,覆盖 AppBarLayout?像这样!五

具有覆盖内容的 AppBarLayout

就像 Play 商店一样!五

就像在 Play Store V 上一样

我的带有 CoordinatorLayout 的 AppBarLayout 和带有 RelativeLayout 的 NestedScrollView 作为内容看起来像这样!五

<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:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="@dimen/_118sdp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsingToolbarLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:contentScrim="@color/mpc_pink"
        app:expandedTitleMarginStart="@dimen/_40sdp"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <de.mypostcardstore.widgets.ItemImageView
            android:id="@+id/header"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:src="@color/mpc_pink"
            app:layout_collapseMode="parallax"
            app:layout_collapseParallaxMultiplier="0.7" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/article_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:minHeight="?attr/actionBarSize"
            app:contentScrim="@color/mpc_pink"
            app:layout_collapseMode="pin"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />


    </android.support.design.widget.CollapsingToolbarLayout>

</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?android:colorBackground"
    android:fillViewport="true"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <RelativeLayout
        android:layout_width="match_parent".....>

如果有人可以帮助我,那就太棒了。我在互联网上找不到任何东西..提前谢谢你!

4

1 回答 1

-1

不难,给你一些伪 XML

<FrameLayout>

    // this is the background part
    <LinearLayout>
       <Top part "blue">
       <Bottom part "white">
    <LinearLayout/>

    // here is your main content that overlay the background
    <MainContent margingTop="toolbar_height + something more"/>

    // here is the toolbar with no background
    <ToolBar background=@null height="toolbar_height"/>
<FrameLayout/>
于 2015-06-25T15:21:05.263 回答