YoKeyword / Fragmentation

[DEPRECATED] A powerful library that manage Fragment for Android
Apache License 2.0
9.72k stars 2.11k forks source link

viewpager+fragment快速滑动问题 #1159

Open adminLiu-s opened 5 years ago

adminLiu-s commented 5 years ago

问题:当快速滑动时,会导致fragment部分不见或者全部不见,如图: image image

在博主的demo中我也试过创建viewpager+fragment并无任何问题,这是我自己项目中的代码: private String[] mTitles;

private List<Fragment> mFragments;

private MyOrderPageAdapter mAdapter;

mTitles = UIUtils.getStringArray(R.array.my_order_tab); mFragments = new ArrayList<>(); mFragments.add(MyOrderChildFragment.newInstance(1)); mFragments.add(MyOrderChildFragment.newInstance(2)); mAdapter = new MyOrderPageAdapter(getChildFragmentManager(),mTitles,mFragments); mVpContent.setAdapter(mAdapter); mTlContent.setupWithViewPager(mVpContent);

适配器中: @Override public Fragment getItem(int i) { return mFragments.get(i); }

子fragment布局: <com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/srl_content" android:layout_width="match_parent" android:layout_height="match_parent">

<android.support.v7.widget.RecyclerView
    android:id="@+id/rv_content"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="@dimen/qb_px_24"
    android:paddingRight="@dimen/qb_px_24"/>

</com.scwang.smartrefresh.layout.SmartRefreshLayout>

只有快速滑动才会出现,个人技术有限,找不出原因,还请大神帮忙看看😺

zhangjianwei1 commented 5 years ago

设置预加载试试

adminLiu-s commented 5 years ago

设置预加载试试

也没用......都试过了

cocowobo commented 5 years ago

有没有使用滑动退出功能,有的话,请关闭子fragment的滑动推出功能,没有的话,就不知道了

zhangjianwei1 commented 5 years ago

是不是动态加载数据的,因为快速滑动的时候频繁请求数据,没有请求成功导致页面空白

892848153 commented 4 years ago

兄弟啊,咋没下文了。我也碰到了这个问题。有没有解决方案啊

JantHsueh commented 4 years ago

fragmentation_swipeback 滑动判断的问题 ,已经解决 implementation 'me.xuexuan:fragmentationx-swipeback:1.0.4',详情 #1237