1
我一直在寻找这个瓦特/没有运气。 Android支持设计库似乎只用于在图像上进行视差设计,但我想要的头像更像是一个帧布局或线性布局,其中包含一个包含覆盖文本和渐变顶点的图像的元素。也就是说,一个更复杂的头文件会缩小文本的大小,以使视差进入状态栏标题。Android协调布局与视差标题线性布局?
有谁知道如何做到这一点?我试着筑巢一个NestedScrollLayout但是这不是我想要做的任何:-(
我一直在寻找这个瓦特/没有运气。 Android支持设计库似乎只用于在图像上进行视差设计,但我想要的头像更像是一个帧布局或线性布局,其中包含一个包含覆盖文本和渐变顶点的图像的元素。也就是说,一个更复杂的头文件会缩小文本的大小,以使视差进入状态栏标题。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>
你能给的另一应用这种效果的例子吗?我真的不明白你在问什么...... –
我希望我有一个例子...我们的设计师决定让它变得具有挑战性:-( 想象一下Google Play商店的应用程序列表,图片顶部。一个进度条,评级星,文本,渐变等(即它不只是一个图像),保持其余的行为,向上滚动,图像及其上的所有东西都会隐藏,所以只有工具栏可见。 – kenyee
仍然不完全理解你在问什么......在我的脑海中,我想象到当页面滚动时,图像本身会滚动,但评分星星,文本等会折叠成工具栏。如果这两个状态都有一些图像/线框,那么这会非常有帮助...... –