首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用新材料设计覆盖内容AppBarLayout

用新材料设计覆盖内容AppBarLayout
EN

Stack Overflow用户
提问于 2015-06-25 15:15:45
回答 1查看 1.1K关注 0票数 1

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

喜欢游戏商店!V

My AppBarLayout with CoordinatorLayout,NestedScrollView with RelativeLayout作为内容,如下所示!V

代码语言:javascript
复制
<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".....>

,如果有人能帮我,那就太棒了。我在网上找不到ANYthing。提前谢谢你!

EN

回答 1

Stack Overflow用户

发布于 2015-06-25 15:21:05

不难,您可以使用一些伪XML。

代码语言:javascript
复制
<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/>
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31054316

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档