我在启动Fragment时遇到此错误。有时片段显示,有时则不显示,只应显示一个空白屏幕。
当时logcat显示“
在0xa2ee7500(RippleDrawable)上的endAllActiveAnimators,其句柄为0xa1c126d0“

还请描述endAllActiveAnimators

代码如下

   public class SingleArtViewDetail extends BaseActivity {

@BindView(R.id.tabSingleartLayoutHome)
TabLayout tabLayout;
@BindView(R.id.viewPagerSingleartHome)
ViewPager viewPager;
ViewPagerAdapter viewPagerAdapter;
private ViewArtDetailFragment viewArtDetailFragment = new ViewArtDetailFragment();
private CommentsFragment commentsFragment = new CommentsFragment();
private SimilarArtFragment similarArtFragment = new SimilarArtFragment();
Activity activity;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_single_art_view_detail);
    if(getIntent()!=null) {
        EventBus.getDefault().postSticky(new ArtIdEvent(getIntent().getStringExtra("artid")));

    }
    ButterKnife.bind(this);
    setToolBar("");
    setTabs();
    activity=SingleArtViewDetail.this;
   // EventBus.getDefault().register(this);
}

@Override
protected void onDestroy() {
 //   EventBus.getDefault().unregister(this);
    super.onDestroy();
}

private void setTabs() {
    viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
    viewPagerAdapter.addFrag(viewArtDetailFragment, "");
    viewPagerAdapter.addFrag(commentsFragment, "");
    viewPagerAdapter.addFrag(similarArtFragment, "");
    viewPager.setAdapter(viewPagerAdapter);
    viewPager.setOffscreenPageLimit(3);
    tabLayout.setupWithViewPager(viewPager);
    final int[] ICONS = new int[]{
            R.drawable.ic_addtocart,
            R.drawable.ic_comments,
            R.drawable.ic_similaritems};
    final int[] ICONSUNSELECTED = new int[]{
            R.drawable.ic_addtocartselected,
            R.drawable.ic_commentsselected,
            R.drawable.ic_similaritemsselected};
    tabLayout.getTabAt(0).setIcon(ICONS[0]);
    tabLayout.getTabAt(1).setIcon(ICONSUNSELECTED[1]);
    tabLayout.getTabAt(2).setIcon(ICONSUNSELECTED[2]);
    tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
        @Override
        public void onTabSelected(TabLayout.Tab tab) {
            System.out.println("selected"+tab.getPosition());
            switch (tab.getPosition())
            {
                case 0:
                    tabLayout.getTabAt(0).setIcon(ICONS[0]);
                    break;
                case 1:
                    tabLayout.getTabAt(1).setIcon(ICONS[1]);

                    break;
                case 2:
                    tabLayout.getTabAt(2).setIcon(ICONS[2]);
                    break;
            }
          //  tab.setIcon(R.drawable.newicon);
            //also you can use tab.setCustomView() too
        }

        @Override
        public void onTabUnselected(TabLayout.Tab tab) {
            //tab.setIcon(R.drawable.oldicon);
            System.out.println("unselected"+tab.getPosition());
            switch (tab.getPosition())
            {
                case 0:
                    tabLayout.getTabAt(0).setIcon(ICONSUNSELECTED[0]);
                    break;
                case 1:
                    tabLayout.getTabAt(1).setIcon(ICONSUNSELECTED[1]);

                    break;
                case 2:
                    tabLayout.getTabAt(2).setIcon(ICONSUNSELECTED[2]);
                    break;
            }
        }

        @Override
        public void onTabReselected(TabLayout.Tab tab) {
            System.out.println(tab);
        }
    });
}}


片段为

 public class ViewArtDetailFragment extends BaseFragment {

Context context;
String artid;
SingleImageModel singleImageModel = new SingleImageModel();
SingleArtDetail singleArtDetail;
@BindView(R.id.layout_artdetail)
LinearLayout layout_artdetail;
@BindView(R.id.progressbar)
ProgressBar progressbar;
@BindView(R.id.pager)
ImageView viewPager;
@BindView(R.id.horizontalscrlview)
HorizontalScrollView horizontalscrlview;
@BindView(R.id.tv_arttitle)
TextView tv_arttitle;
@BindView(R.id.artbaseprice)
TextView tv_artbaseprice;
@BindView(R.id.tv_artownername)
TextView tv_artownername;
@BindView(R.id.tv_artdescrptn)
TextView tv_artdescrptn;
@BindView(R.id.tv_viewdimension)
TextView tv_viewdimension;
@BindView(R.id.tv_viewyearofcreation)
TextView tv_viewyearofcreation;
@BindView(R.id.tv_viewcategory)
TextView tv_viewcategory;
@BindView(R.id.tv_viewsubject)
TextView tv_viewsubject;
@BindView(R.id.tv_viewstyle)
TextView tv_viewstyle;
@BindView(R.id.tv_viewmaterials)
TextView tv_viewmaterials;
@BindView(R.id.tv_viewmedium)
TextView tv_viewmedium;
@BindView(R.id.tv_vieworiginal)
TextView tv_vieworiginal;
@BindView(R.id.tv_viewprint)
TextView tv_viewprint;
@BindView(R.id.thumbnails)
LinearLayout _thumbnails;

@BindView(R.id.tv_copyright)
TextView tv_copyright;
//   private GalleryPagerAdapter _adapter;
private ArrayList<String> thumb_images = new ArrayList<>();
private ArrayList<String> gallery_images = new ArrayList<>();

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_view_art_details, container, false);
    ButterKnife.bind(this, view);
    context = getActivity();
    ArtIdEvent artIdEvent = EventBus.getDefault().getStickyEvent(ArtIdEvent.class);
    artid = artIdEvent.getArtId();
    callingArtDetailApi();
    return view;
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);}}


片段xml如下

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
>
<ProgressBar

    android:id="@+id/progressbar"
    android:layout_centerInParent="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
<LinearLayout
    android:visibility="gone"

    android:id="@+id/layout_artdetail"
    android:layout_below="@+id/toolbar"
    android:layout_width="wrap_content"
    android:layout_height="match_parent">
    <ScrollView

        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout

            android:layout_marginBottom="80dp"
            android:orientation="vertical"
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            >
            <ImageView
                android:layout_marginRight="@dimen/tabsmall_margin"
                android:layout_marginLeft="@dimen/tabsmall_margin"
                android:id="@+id/pager"
                android:layout_width="match_parent"
                android:layout_height="@dimen/viewpagerheight"
                >
            </ImageView>



            <HorizontalScrollView
                android:id="@+id/horizontalscrlview"
                android:layout_marginRight="@dimen/tabsmall_margin"
                android:layout_marginLeft="@dimen/tabsmall_margin"
                android:layout_width="match_parent"
                android:layout_height="@dimen/horizonalscrollheight"
                android:layout_gravity="bottom"
                >
                <LinearLayout
                    android:id="@+id/thumbnails"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:gravity="center_vertical"
                    android:orientation="horizontal"
                    android:paddingTop="2dp">

                </LinearLayout>
            </HorizontalScrollView>
            <include
                layout="@layout/content_view_art_detail"/>
        </LinearLayout>
    </ScrollView>
</LinearLayout>




请帮助解决此问题,在此先感谢。

编辑

错误的完整日志(由OP发表在评论中):


  06-29 13:06:55.702 24382-24382 / com.cushbuart.cushbuart E / log:onsavedInstanceState 06-29 13:07:01.840 24382-24525 / com.cushbuart.cushbuart D / OpenGLRenderer:0x9ecd8b80(RippleDrawable)上的endAllActiveAnimators与句柄0xa19a4540 06-29 13:07:03.612 24382-24382 / com.cushbuart.cushbuart D / EventBus:没有注册事件类com.cushbuart.cushbuart.eventmodel.ArtIdEvent的订阅者06-29 13:07:03.612 24382-24382 / com.cushbuart.cushbuart D / EventBus:没有为事件类org.greenrobot.eventbus.NoSubscriberEvent注册的订阅者

最佳答案

解决了我的问题,这是因为我的tablayout xml文件。
我将其更改为

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >


    <include
        layout="@layout/toolbar"/>

    <android.support.v4.view.ViewPager
        android:layout_below="@+id/toolbar"
        android:id="@+id/viewPagerSingleartHome"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        />


    <android.support.design.widget.TabLayout
        android:id="@+id/tabSingleartLayoutHome"
        app:tabMode="fixed"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:elevation="6dp"
        app:tabTextColor="#d3d3d3"
        app:tabSelectedTextColor="@color/colorwhite"
        app:tabIndicatorColor="@color/colorwhite"
        android:minHeight="?attr/actionBarSize"
        android:layout_alignParentBottom="true"
        />
</RelativeLayout>

08-07 00:57