【发布时间】:2021-04-23 13:46:42
【问题描述】:
我已经从使用列表视图的视图寻呼机中膨胀了一个片段。并且列表视图不支持预棒棒糖设备中的 setNestedScrollingEnabled。所以我在 NestedScrollView 中添加了列表视图,但是在滚动列表时它不会滚动。
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:id="@+id/fragment_item_view"
android:background="@color/white"
android:isScrollContainer="true">
<ProgressBar
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_centerInParent="true" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:fillViewport="true">
<ListView
android:id="@+id/list_item_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:clipToPadding="false"
android:divider="@color/gray_stroke_color"
android:dividerHeight="0.5dp"
android:paddingBottom="@dimen/padding_64dp" >
</ListView>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
谁能建议我任何解决方案。提前致谢。
【问题讨论】:
-
尝试使用 RecyclerView 代替 ListView
-
这是我知道的最后一个解决方案。但是有一个很大的没有。我的项目中的列表视图。因此,更改所有这些非常耗时。因此,如果有人可以在列表视图方面帮助我,那就太好了。
-
listView 上不需要 scrollView,因为 listview 有自己的滚动功能