【发布时间】:2019-05-17 11:29:54
【问题描述】:
我在自己的片段中的 LinearLayout 中有一个水平 recyclerView。片段的占位符被包裹在一个水平滚动视图中。当我添加片段时,recyclerview nestedScroll 设置为 false,HorizontalScrollView 控制滚动。
但是,我现在已经在 recyclerview 上实现了 ItemTouchHelper.Callback 以便能够对单元格重新排序。但是,当我将一个单元格移出屏幕时,它不会随之滚动。我尝试更改nestedScroll 和fixedSize 但没有任何效果。
我不能使用 NestedScrollView,因为 recyclerView 是水平正确的?
任何建议
主xml
<HorizontalScrollView
android:id="@+id/timeline_horizontal_scroll_view"
style="@style/timeline_horizontal_scroll_view_style">
<FrameLayout
android:id="@+id/media_scrub_placeholder"
style="@style/media_scrub_placeholder_style" />
</HorizontalScrollView>
片段 xml
<LinearLayout
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:gravity="center"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/timeline_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout>
【问题讨论】:
标签: android android-layout user-interface kotlin androidx