【发布时间】:2019-04-06 18:10:20
【问题描述】:
我的应用在 AppBarLayout 中有 3 种布局:Toolbar、FrameLayout 和 LinearLayout。当我向上滚动 NestedScrollView 时,必须隐藏 FrameLayout 但工具栏必须留在他的位置,并且 LinearLayout 必须在工具栏下。在当前情况下,没有滚动任何内容。
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorFilters"
/>
<FrameLayout
android:id="@+id/userinfo_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|snap" />
<LinearLayout
android:id="@+id/navigation_tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="8dp"
android:padding="30dp"
android:text="@string/fully_text"
android:textSize="20sp" />
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
【问题讨论】:
标签: android material-design android-coordinatorlayout android-appbarlayout