2016-05-23 82 views
0

我有以下布局上调用viewpager顶部的片段彼此重叠

<?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" 
    android:id="@+id/coordinator_bracket_activity" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <FrameLayout 
     android:id="@+id/activity_fragment" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent"> 
    </FrameLayout> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <include 
      android:id="@+id/app_bar_bracket_activity" 
      layout="@layout/app_bar" /> 

      <android.support.design.widget.TabLayout 
       android:id="@+id/tabs" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:foregroundTint="@color/colorAccent" 
       app:tabMode="fixed" 
       app:tabMaxWidth="0dp" 
       app:tabGravity="fill"/> 

      <mypackage.NonSwipeViewPager 
       android:id="@+id/tabs_pager" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1"/> 
    </LinearLayout> 
</android.support.design.widget.CoordinatorLayout> 

的nonswipeviewpager只是,我继承了viewpager禁用某些东西的自定义类。

无论如何,我的应用栏上有一个按钮,需要调用需要覆盖整个屏幕的片段。我会调用它并在框架布局上添加一个片段。在我为标签布局添加viewpager之前,它工作正常。现在我不知道如何处理viewpager。

FragmentTransaction ft = mFM.beginTransaction(); 
        mCustomFragment = CustomFragment.newInstance(mObject, mListOfObjects()); 
        ft.replace(R.id.activity_fragment, mCustomFragment , "CustomFragment"); 
        ft.addToBackStack(null); 
ft.commit(); 

这是我应用栏上按钮的clicklistener。

想法?

回答