【发布时间】:2018-09-09 11:16:04
【问题描述】:
我使用CoordinatorLayout 作为容器和NestedScrollView 来显示我的内容。
我在向下滚动时使用NestedScrollView 隐藏我的工具栏,但是当我尝试滚动并达到布局限制时,通常应在工具栏下方显示的波浪效果不起作用。
这里是
。
如何制作这个效果?如果我使用普通的ScrollView,会显示这个效果,但我不能隐藏我的工具栏。
这是我的布局:
<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:id="@+id/layout_detail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.dicoding.paul.moviecatalog.DetailActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ToolbarTheme">
<android.support.v7.widget.Toolbar
android:id="@+id/tb_my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:theme="@style/ToolbarTheme"
app:popupTheme="@style/ToolbarTheme"
app:layout_scrollFlags="scroll|enterAlways"
app:title="Detail"
app:titleTextAppearance="@style/ToolbarTheme.TitleText"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/activity_detail_content"/>
</android.support.design.widget.CoordinatorLayout>
这是我的详细内容:
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
//contents
//contents
</android.support.v4.widget.NestedScrollView>
【问题讨论】:
-
reach the limit of the layout is not working.你能详细说明一下吗?通过 gif 或其他方式?谢谢 -
@ʍѳђઽ૯ท 你好,我已经编辑了我的问题以获得更好的上下文。谢谢。
-
哦,那波 属于 Android 本身。将
android:clipToPadding="false"添加到NestedScrollView并删除android:orientation="vertical"怎么样?只是猜测.. -
@ʍѳђઽ૯ท 仍然无法正常工作。好吧,这没什么大不了的,但我只是好奇。还是谢谢你。
-
尝试在
NestedScrollView中使用(真-假)android:nestedScrollingEnabled。但是,这来自 Android 本身。
标签: android android-layout android-coordinatorlayout android-nestedscrollview