我有活动
<RelativeLayout>
<FrameLayout/> // fragmentContainer
<OtherView/>
<RelativeLayout>在fragmentContainer中,我使用带有3个选项卡的TabLayout将片段放入其中。
TabLayout
ViewPager在每个选项卡上,我都使用相同的ListFragment,如下所示:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.SwipeRefreshLayout>
在PagerAdapter中,我在其中保存了ListFragment实例的列表。
FRAGMENTS: List<Fragment> = listOf(
ListFragment.newInstance(Mode.FIRST)
ListFragment.newInstance(Mode.SECOND)
ListFragment.newInstance(Mode.THIRD)
)取决于模式,它从不同的源加载数据。
问题是,Swipe只对前两个片段起作用。第三,没有滑动的手势。
发布于 2017-10-30 13:15:31
问题是在回收视图内容加载到第三个选项卡。第一个加载项如下:
this.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
0)https://stackoverflow.com/questions/47014391
复制相似问题