【发布时间】:2019-01-05 13:17:28
【问题描述】:
我有一个活动,其中有一个nestedscrollview,里面是一个视图寻呼机视图寻呼机有一个片段,片段有一个nestedscrollview。下面是结构:
<LinearLayout>
<NestedScrollView (Parent)
android:layout_width="match_parent"
android:id="@+id/parent_scroll"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:fillViewport="true">
<LinearLayout << Stuck layout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView />
</LinearLayout>
<cViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</NestedScrollView>
</LinearLayout>
视图内部有一个片段。片段的布局如下:
<NestedScrollView (inside fragment, child)
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:descendantFocusability="blocksDescendants"
android:paddingBottom="40dp"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none"
app:layoutManager="android.support.v7.widget.LinearLayoutManager">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:orientation="vertical"/>
</NestedScrollView>
问题
当尝试滚动子视图(片段内的 NestedScrollView)时,它会滚动,但活动内的父嵌套滚动视图不会滚动。 我已经实现了协调器布局,但存在一个问题。在抛出整个布局时会卡住。但是在缓慢滚动时有效,因此将其删除。
如果需要更多代码,请告诉我。
【问题讨论】:
标签: android android-fragments android-viewpager android-nestedscrollview