android – 首先在协调器布局中隐藏中间视图

android – 首先在协调器布局中隐藏中间视图,第1张

概述我的布局如下 >布局1 >布局2 > ScrollView 滚动时我需要Layout2先消失,然后是Layout1.例如,看下面的gif中间视图先消失然后顶视图消失.我怀疑我需要一些自定义行为代码,但不知道从哪里开始. 这是我目前的xml <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.a 我的布局如下

>布局1
>布局2
> ScrollVIEw

滚动时我需要Layout2先消失,然后是Layout1.例如,看下面的gif中间视图先消失然后顶视图消失.我怀疑我需要一些自定义行为代码,但不知道从哪里开始.

这是我目前的xml

<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:layout_wIDth="match_parent"androID:layout_height="match_parent"androID:fitsSystemwindows="true"tools:context="com.example.chamoda.coordinatelayoutdemo.ScrollingActivity"><androID.support.design.Widget.AppbarLayout    androID:ID="@+ID/app_bar"    androID:layout_wIDth="match_parent"    androID:layout_height="180dp"    androID:fitsSystemwindows="true"    androID:theme="@style/Apptheme.AppbarOverlay">    <linearLayout        androID:layout_wIDth="match_parent"        androID:layout_height="90dp"        androID:background="@color/colorAccent"        app:layout_scrollFlags="scroll" >    </linearLayout>    <linearLayout        androID:layout_wIDth="match_parent"        androID:layout_height="90dp"        androID:background="@color/colorPrimary"        app:layout_scrollFlags="scroll" >    </linearLayout></androID.support.design.Widget.AppbarLayout><androID.support.v4.Widget.nestedScrollVIEw 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:layout_wIDth="match_parent"    androID:layout_height="match_parent"    app:layout_behavior="@string/appbar_scrolling_vIEw_behavior"    tools:context="com.example.chamoda.coordinatelayoutdemo.ScrollingActivity"    tools:showIn="@layout/activity_scrolling">    <TextVIEw        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:layout_margin="@dimen/text_margin"        androID:text="@string/large_text" /></androID.support.v4.Widget.nestedScrollVIEw>

如何使用坐标布局存档该动画?

解决方法 您可以使用CollapsingToolbarLayout和工具栏来制作它.
有关更多信息,请参阅此精彩教程:

https://inthecheesefactory.com/blog/android-design-support-library-codelab/en

总结

以上是内存溢出为你收集整理的android – 首先在协调器布局中隐藏中间视图全部内容,希望文章能够帮你解决android – 首先在协调器布局中隐藏中间视图所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1123977.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存