Ren*_*ier 31 android android-recyclerview android-nestedscrollview
在一个视图分页器中,我有几个片段,其中一个片段使用带有标题和recyclerview的嵌套scrollview:
<android.support.v4.widget.NestedScrollView
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/scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.m360.android.fragment.Members.MemberDetailsFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="20dp">
<header/>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:paddingTop="0dp" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)
标签"header"代表了一个复杂的布局,我不想在这里发布,因为它会大量延伸代码.
当我在标签之间切换时,它会将海峡滚动到回收站视图.标题是隐藏的,我必须向上滚动才能看到它.
关于是什么原因的任何想法?如果可以避免,我不想在我的适配器中使用类型.
Alb*_*lvo 23
我们有类似的问题.我们有一个垂直的RecyclerView.此垂直的每个项目都RecyclerView包含一个横向RecyclerView,就像在Android TV应用中一样.
当我们将支持库从23.4.0升级到24.0.0时,突然出现了自动滚动.特别是,当我们打开一个Activity然后然后返回时,垂直RecyclerView向上滚动,这样当前的水平RecyclerView行不会被切断并且行完全显示.
添加android:descendantFocusability="blocksDescendants"修复问题.
但是,我找到了另一种解决方案,它也有效.在我们的例子中,垂直RecyclerView包含在一个FrameLayout.如果我补充android:focusableInTouchMode="true"一点FrameLayout,问题就会消失.
这里提到的第三个解决方案,基本上都是在调用setFocusable(false)child/inner RecyclerViews.我没试过这个.
| 归档时间: |
|
| 查看次数: |
11387 次 |
| 最近记录: |