gpt4 book ai didi

android - 如何使用协调器布局中的嵌套 ScrollView 进行平滑滚动

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:53:26 25 4
gpt4 key购买 nike

<android.support.design.widget.CoordinatorLayout 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="match_parent"
android:background="@android:color/background_light"
android:fitsSystemWindows="true">

<android.support.design.widget.AppBarLayout
android:id="@+id/main_appbar"
android:layout_width="match_parent"
android:layout_height="400dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/main_collapsing"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleTextAppearance="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:title="">

<fragment xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mydermacy.www.beyou.activities.CompareClinicsActivity" />

<android.support.v7.widget.Toolbar
android:id="@+id/main_toolbar_clinics"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

</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"
app:layout_behavior="@string/appbar_scrolling_view_behavior">


<android.support.v7.widget.RecyclerView
android:id="@+id/rc_clinic_compare"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:behavior_overlapTop="184dp"
android:background="@color/background" />

</android.support.v4.widget.NestedScrollView>

<!--app:layout_behavior="@string/appbar_scrolling_view_behavior" />-->

</android.support.design.widget.CoordinatorLayout>

我的布局使用 CoordinatorLayout 作为 Root View ,在其中我有两个 subview AppBarLayoutNestedScrollView。我无法平滑滚动。如何实现平滑滚动?

最佳答案

CoordinatorLayoutCollapsingToolbarLayout 平滑滚动是错误,Google 仍未修复它。 :|

删除 NestedScrollViewRecyclerViewapp:layout_behavior="@string/appbar_scrolling_view_behavior" 就够了,修复吧。

您可以使用第三方库:smooth-app-bar-layout

关于android - 如何使用协调器布局中的嵌套 ScrollView 进行平滑滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41650190/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com