Activity中含有Fragment后可以从onPause()返回到onResuem()吗?

最近在做一个项目,首页需要多个RecyclerView,所以我使用NestedScrollView来嵌套,如下所示。

布局文件的结构大概是这样:

<?xml version="1.0" encoding="utf-8"?><android.support.design.widget.CoordinatorLayout     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:layout\_width="match\_parent"     android:layout\_height="match\_parent"     tools:context="com.sherlock.sectiontv.activity.customer.HomeActivity">     <android.support.v4.widget.SwipeRefreshLayout         android:id="@+id/home\_swipe\_refresh"         android:layout\_width="match\_parent"         android:layout\_height="match\_parent">         <android.support.v4.widget.NestedScrollView             android:layout\_width="match\_parent"             android:layout\_height="wrap\_content"             app:layout\_behavior="@string/appbar\_scrolling\_view\_behavior">             <LinearLayout                 android:layout\_width="match\_parent"                 android:layout\_height="wrap\_content"                 android:orientation="vertical">                             <!-- banner和多个rv -->             </LinearLayout>         </android.support.v4.widget.NestedScrollView>     </android.support.v4.widget.SwipeRefreshLayout></android.support.design.widget.CoordinatorLayout>

在代码中,进行了如下设置:

mHomeRvArticle.setAdapter(new HomeArticleAdapter(HomeActivity.this, jsonArray)); LinearLayoutManager layoutManager = new LinearLayoutManager(HomeActivity.this,          LinearLayoutManager.VERTICAL, false); layoutManager.setSmoothScrollbarEnabled(true); layoutManager.setAutoMeasureEnabled(true); mHomeRvArticle.setLayoutManager(layoutManager); mHomeRvArticle.setHasFixedSize(true); mHomeRvArticle.setNestedScrollingEnabled(false);

最后代码运行,在Android5.0, 6.0都没问题,但是在Android7.1下一卡一卡的,有大神知道原因吗~

查看全部 1个回答

<p>不要这样做,你这种情况完全可以用多个item type来实现。1</p >
22222

43434343443
投票 0 0 0