我一直在到处寻找这个没有运气。Android 支持设计库似乎是为仅在图像上进行视差而设计的,但我想要一个更像框架布局或线性布局的标题,其中包含一堆元素,包括带有叠加文本的图像和顶部的渐变。即,一个更复杂的标题,它会缩小带有视差的文本到带有不同字体大小的状态栏标题。
有谁知道如何做到这一点?我尝试嵌套一个 NestedScrollLayout 但这也不是我想做的:-(
我一直在到处寻找这个没有运气。Android 支持设计库似乎是为仅在图像上进行视差而设计的,但我想要一个更像框架布局或线性布局的标题,其中包含一堆元素,包括带有叠加文本的图像和顶部的渐变。即,一个更复杂的标题,它会缩小带有视差的文本到带有不同字体大小的状态栏标题。
有谁知道如何做到这一点?我尝试嵌套一个 NestedScrollLayout 但这也不是我想做的:-(
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="@dimen/detail_backdrop_height"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="10dp"
android:background="@color/nav_view_header"
app:expandedTitleMarginEnd="64dp">
<RelativeLayout
android:id="@+id/header_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/ic_vp_placeholder_largo"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax" >
<!-- Your progress bar, rating stars, text, a gradient, etc. -->
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin" />
</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:id="@+id/nestedScroll"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<!-- Your scrolling content -->
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>