Android-滚动更改上的淡入淡出工具栏
问题很简单,我想淡入/淡出工具栏上的滚动像谷歌播放应用程序的变化 我了解第三方库,如: 或 但我不想使用它们,我想学习如何实现这种效果 从本教程中: 我发现如何在操作栏上实现这种效果,但工具栏呢?基于Cyril Mottier的教程的第一个库。所以几乎是一样的东西。CyrillMottier在CrollChangedListener上编写了类,您可以将其附加到工具栏。你应该想一想。Android-滚动更改上的淡入淡出工具栏,android,scroll,android-actionbar,toolbar,Android,Scroll,Android Actionbar,Toolbar,问题很简单,我想淡入/淡出工具栏上的滚动像谷歌播放应用程序的变化 我了解第三方库,如: 或 但我不想使用它们,我想学习如何实现这种效果 从本教程中: 我发现如何在操作栏上实现这种效果,但工具栏呢?基于Cyril Mottier的教程的第一个库。所以几乎是一样的东西。CyrillMottier在CrollChangedListener上编写了类,您可以将其附加到工具栏。你应该想一想。 <?xml version="1.0" encoding="utf-8"?> <android
<?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"
xmlns:custom="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layoutDirection="ltr"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="450dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:background="@color/colorPrimary"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:gravity="right"
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="@color/colorPrimary"
app:expandedTitleMarginStart="10dp"
app:expandedTitleMarginEnd="10dp">
<!--your image or slider-->
<com.daimajia.slider.library.SliderLayout
android:background="#ffffff"
android:id="@+id/slider"
android:layout_width="match_parent"
custom:pager_animation="Accordion"
custom:indicator_visibility="visible"
android:fitsSystemWindows="true"
android:gravity="center"
custom:pager_animation_span="500"
android:layout_height="match_parent"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:elevation="8dp"
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:background="#cccccc"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:orientation="vertical">
<!--your desighn-->
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>