Toolbar与ScrollView实现上下滑动隐藏

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    android:background="@color/white"
    tools:context=".ui.activity.HomeBloodPressureActivity">

    <androidx.appcompat.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="140dp"
    android:background="@color/open_inform_power"
    app:contentInsetStart="0dp"
    app:title="KING"
    android:orientation="vertical"
    app:titleTextColor="@color/white"
        tools:ignore="MissingConstraints">
    <RelativeLayout
        android:id="@+id/title"
        android:background="@color/color_picker113"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        tools:ignore="MissingConstraints">
        <ImageView
            app:layout_constraintTop_toTopOf="parent"
            android:layout_marginTop="35dp"
            app:layout_constraintLeft_toLeftOf="parent"
            android:layout_marginLeft="20dp"
            android:id="@+id/back"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:src="@mipmap/black_back" />
        <TextView
            app:layout_constraintTop_toTopOf="parent"
            android:layout_marginTop="35dp"
            android:textColor="@color/black"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"

            android:layout_marginStart="0dp"
            android:textSize="20dp"
            android:text="@string/rate"
            />
        <ImageView
            android:layout_marginTop="35dp"
            android:id="@+id/iv_calendar"
            android:layout_width="match_parent"
            android:layout_height="20dp"
            android:layout_marginLeft="320dp"

            android:layout_alignParentRight="true"
            android:src="@mipmap/calendar"
            android:visibility="visible"
            tools:ignore="NotSibling" />

        <ImageView
            android:layout_marginLeft="100dp"
            android:layout_marginTop="70dp"
            android:id="@+id/iv_reduce_date"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:background="@mipmap/returnn"
            tools:ignore="MissingConstraints" />
        <ImageView
            android:layout_marginTop="70dp"
            android:layout_marginLeft="300dp"
            android:id="@+id/iv_date_add"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:background="@mipmap/entrance"
            tools:ignore="MissingConstraints" />
        <ViewFlipper
            android:layout_marginLeft="150dp"
            android:layout_marginTop="70dp"
            android:id="@+id/viewFlipper"
            android:layout_width="120dp"
            android:layout_height="25dp"

            android:textAlignment="center"
            app:layout_constraintTop_toTopOf="parent"
            tools:ignore="MissingConstraints" />


    </RelativeLayout>


    </androidx.appcompat.widget.Toolbar>
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
       >
    <TextView
        android:backgroundTint="@color/yellow"
        android:layout_width="match_parent"
        android:background="@color/yellow"
        android:layout_height="400dp"
        />
    <LinearLayout
        app:layout_constraintTop_toTopOf="parent"
        android:id="@+id/number"
        android:gravity="center_vertical"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        tools:ignore="MissingConstraints">
        <ImageView
            android:layout_width="16dp"
            android:layout_height="16dp"
            android:src="@mipmap/blood_pressure"
            />
        <TextView
            android:textColor="@color/black"
            android:layout_marginLeft="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="30sp"
            android:text="62"
            />
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            >
            <TextView
                android:textColor="@color/black"
                android:layout_marginLeft="5dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/static_state"
                />
            <TextView
                android:textColor="@color/black"
                android:layout_marginLeft="5dp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/next_minute"
                />
        </LinearLayout>


    </LinearLayout>
    <LinearLayout
        app:layout_constraintTop_toBottomOf="@+id/number"
        android:id="@+id/pressure"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        tools:ignore="MissingConstraints">
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="150dp"
            android:layout_weight="2"
            android:orientation="vertical"
            android:gravity="center">
            <TextView
                android:id="@+id/tv_Average_daily_steps"
                android:text="@string/verage_rate"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <TextView
                    android:textSize="16sp"
                    android:textColor="@color/black"
                    android:text="63"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp" />
                <TextView
                    android:layout_marginLeft="5dp"
                    android:text="@string/mmhg"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp" />
            </LinearLayout>

        </LinearLayout>
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="150dp"
            android:layout_weight="2"
            android:orientation="vertical"
            android:gravity="center">
            <TextView
                android:text="@string/lowest_rate"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <TextView
                    android:textSize="16sp"
                    android:textColor="@color/black"
                    android:text="60"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp" />
                <TextView
                    android:layout_marginLeft="5dp"
                    android:text="@string/mmhg"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp" />
            </LinearLayout>


        </LinearLayout>
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="150dp"
            android:layout_weight="2"
            android:orientation="vertical"
            android:gravity="center">
            <TextView
                android:id="@+id/tv_Average_daily_complete"
                android:text="@string/highest_rate"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <TextView
                    android:textColor="@color/black"
                    android:text="69"
                    android:textSize="16sp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp" />
                <TextView
                    android:layout_marginLeft="5dp"
                    android:text="@string/mmhg"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp" />
            </LinearLayout>

        </LinearLayout>
    </LinearLayout>
    <View
        app:layout_constraintBottom_toTopOf="@+id/Today_datas"
        android:layout_width="match_parent"
        android:layout_height="5dp"
        android:background="@color/call_reminder_line"
        tools:ignore="MissingConstraints" />
    <LinearLayout
        android:id="@+id/Today_datas"
        android:gravity="center_vertical"
        app:layout_constraintTop_toBottomOf="@+id/pressure"
        android:layout_marginTop="5dp"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        tools:ignore="MissingConstraints">
        <ImageView
            android:layout_width="16dp"
            android:layout_height="16dp"
            android:src="@mipmap/blood_pressure"
            />
        <TextView
            android:textColor="@color/black"
            android:layout_marginLeft="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/heart_rate_range"
            />

    </LinearLayout>
    <View
        app:layout_constraintTop_toBottomOf="@+id/Today_datas"
        android:layout_width="match_parent"
        android:layout_height="0.5dp"
        android:background="@color/color_picker51"
        tools:ignore="MissingConstraints" />
    <LinearLayout
        android:id="@+id/static_stats"
        android:gravity="center_vertical"
        app:layout_constraintTop_toBottomOf="@+id/Today_datas"
        android:layout_marginTop="15dp"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        tools:ignore="MissingConstraints">
        <TextView
            android:paddingLeft="15dp"
            android:layout_weight="1"
            android:textColor="@color/colorAccent"
            android:layout_marginLeft="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/static_state"
            />
        <TextView
            android:layout_weight="1"
            android:layout_marginLeft="0dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="(≤100次每分钟)"
            />
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

        </LinearLayout>
        <TextView
            android:paddingLeft="160dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:text="100%"
            />
    </LinearLayout>
    <View
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        app:layout_constraintBottom_toBottomOf="@+id/static_stats"
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="@color/colorAccent"
        tools:ignore="MissingConstraints" />
    <LinearLayout
        android:id="@+id/stress_states"
        android:gravity="center_vertical"
        app:layout_constraintTop_toBottomOf="@+id/static_stats"
        android:layout_marginTop="15dp"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        tools:ignore="MissingConstraints">
        <TextView
            android:paddingLeft="15dp"
            android:layout_weight="1"
            android:textColor="@color/color_picker14"
            android:layout_marginLeft="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/stress_state"
            />
        <TextView
            android:layout_weight="1"
            android:layout_marginLeft="0dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="(101-120次每分钟)"
            />
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

        </LinearLayout>
        <TextView
            android:paddingLeft="160dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:text="0%"
            />
    </LinearLayout>
    <View
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        app:layout_constraintBottom_toBottomOf="@+id/stress_states"
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="@color/color_picker38"
        tools:ignore="MissingConstraints" />
    <LinearLayout
        android:id="@+id/fat_states"
        android:gravity="center_vertical"
        app:layout_constraintTop_toBottomOf="@+id/stress_states"
        android:layout_marginTop="15dp"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        tools:ignore="MissingConstraints">
        <TextView
            android:paddingLeft="15dp"
            android:layout_weight="1"
            android:textColor="@color/color_picker24"
            android:layout_marginLeft="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/fat_state"
            />
        <TextView
            android:layout_weight="1"
            android:layout_marginLeft="0dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="(121-140次每分钟)"
            />
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

        </LinearLayout>
        <TextView
            android:paddingLeft="160dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:text="0%"
            />
    </LinearLayout>
    <View
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        app:layout_constraintBottom_toBottomOf="@+id/fat_states"
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="@color/color_picker38"
        tools:ignore="MissingConstraints" />
    <LinearLayout
        android:id="@+id/cardiopulmonary_statuss"
        android:gravity="center_vertical"
        app:layout_constraintTop_toBottomOf="@+id/fat_states"
        android:layout_marginTop="15dp"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        tools:ignore="MissingConstraints">
        <TextView
            android:paddingLeft="15dp"
            android:layout_weight="1"
            android:textColor="@color/color_picker100"
            android:layout_marginLeft="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/cardiopulmonary_status"
            />
        <TextView
            android:layout_weight="1"
            android:layout_marginLeft="0dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="(141-160次每分钟)"
            />
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

        </LinearLayout>
        <TextView
            android:paddingLeft="160dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:text="0%"
            />
    </LinearLayout>
    <View
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        app:layout_constraintBottom_toBottomOf="@+id/cardiopulmonary_statuss"
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="@color/color_picker38"
        tools:ignore="MissingConstraints" />
    <LinearLayout
        android:id="@+id/anaerobic_conditions"
        android:gravity="center_vertical"
        app:layout_constraintTop_toBottomOf="@+id/cardiopulmonary_statuss"
        android:layout_marginTop="15dp"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        tools:ignore="MissingConstraints">
        <TextView
            android:paddingLeft="15dp"
            android:layout_weight="1"
            android:textColor="@color/color_picker112"
            android:layout_marginLeft="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/cardiopulmonary_status"
            />
        <TextView
            android:layout_weight="1"
            android:layout_marginLeft="0dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="(161-180次每分钟)"
            />
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

        </LinearLayout>
        <TextView
            android:paddingLeft="160dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:text="0%"
            />
    </LinearLayout>
    <View
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        app:layout_constraintBottom_toBottomOf="@+id/anaerobic_conditions"
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="@color/color_picker38"
        tools:ignore="MissingConstraints" />
    <LinearLayout
        android:id="@+id/limiting_conditions"
        android:gravity="center_vertical"
        app:layout_constraintTop_toBottomOf="@+id/anaerobic_conditions"
        android:layout_marginTop="15dp"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        tools:ignore="MissingConstraints">
        <TextView
            android:paddingLeft="15dp"
            android:layout_weight="1"
            android:textColor="@color/color_picker44"
            android:layout_marginLeft="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/cardiopulmonary_status"
            />
        <TextView
            android:layout_weight="1"
            android:layout_marginLeft="0dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="(≥181次每分钟)"
            />
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

        </LinearLayout>
        <TextView
            android:paddingLeft="160dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:text="0%"
            />
    </LinearLayout>
    <View
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        app:layout_constraintBottom_toBottomOf="@+id/limiting_conditions"
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="@color/color_picker38"
        tools:ignore="MissingConstraints" />
    </LinearLayout>
</ScrollView>
</LinearLayout>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

信工院李平

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值