gpt4 book ai didi

android - ScrollView 内部没有释放动力

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

在我的 Activity 中,我在一个 ScrollView 中有两个 RecyclerView。问题是,当我轻扫/轻拂 ScrollView 时,滚动会立即停止。有没有办法让 ScrollView 实现动量或惯性,以便在滚动停止之前有一些减速?

我的 XML 如下:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<ProgressBar
android:id="@+id/threadload_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<android.support.v7.widget.RecyclerView 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/subforums"
android:name="net.polunom.forum.fragments.ThreadFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="LinearLayoutManager"
tools:context=".fragments.ThreadFragment"
tools:listitem="@layout/fragment_subforum"/>

<android.support.v7.widget.RecyclerView 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/threadlist"
android:name="net.polunom.forum.fragments.ThreadFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="LinearLayoutManager"
tools:context=".fragments.ThreadFragment"
tools:listitem="@layout/fragment_thread"/>

</LinearLayout>
</ScrollView>

最佳答案

我想通了!我所要做的就是将 setNestedScrollingEnabled(false); 设置为两个 RecyclerView,然后一切都开始正常工作了。

关于android - ScrollView 内部没有释放动力,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34805474/

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