如何制作自定义应用栏,从大标题到带有动画的小标题? [英] How to do a custom app bar from large title to small with animation?
本文介绍了如何制作自定义应用栏,从大标题到带有动画的小标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的意思是
过渡发生在图层上的内容开始滚动时.
The transition occurs as the content on the layer begin to scroll.
它类似于 material.io 中的prominent
>.但是我不知道该怎么做.我找不到例子.
It's similarly to prominent
from material.io. But I don't know how to do it. I could not find an example.
推荐答案
简介
这是通过AppBarLayout
中的View
:Toolbar
和CollapsingToolbarLayout
实现的.
Introduce
This is implemented by View
: Toolbar
and CollapsingToolbarLayout
inside AppBarLayout
.
新项目->选择Scrolling Activity
->下一步->完成
New project -> Choose Scrolling Activity
-> Next -> Finish
您将看到类似的activity_main.xml
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
style="@style/ToolbarTextAppearanceStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
这篇关于如何制作自定义应用栏,从大标题到带有动画的小标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文