2017-03-17 5 views
1

Je suis confronté à un problème de chevauchement de fragments lorsque je gonfle des fragments d'en bas.Vue personnalisée en chevauchement de fragments autre fragment sur le dispositif samsung

enter image description here Ce code est mise en page:

<FrameLayout 
     android:id="@+id/nonAdParent" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/white_blur"> 

     <FrameLayout 
      android:id="@+id/collage_view_container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@color/white_blur" 
      android:layout_marginBottom="@dimen/collageview_margin" /> 

     <FrameLayout 
      android:id="@+id/menu_footer" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom" 
      android:background="@color/colorSecondary" /> 
    </FrameLayout> 
fragment

"collage_view_container" contient 1 vue personnalisée et fragment "menu_footer" contient recyclerview horizontal.

Ceci est du code programme:

getSupportFragmentManager().beginTransaction() 
      .add(R.id.collage_view_container, new CollageContainerFrag().setLayoutModel(model)).commit(); 

    FooterMenuFragment footerFrag = new FooterMenuFragment(); 
    getSupportFragmentManager().beginTransaction() 
      .setCustomAnimations(R.anim.slide_in_up, R.anim.no_anim) 
      .add(R.id.menu_footer, footerFrag).commit(); 

Problème: Vue personnalisée dans le fragment "collage_view_container" fragment chevauchement horizontal dans recyclerview "de menu_footer" uniquement sur l'appareil SAMSUNG. Si je ligne config ce code:

if (SystemUtils.isSamsungDevice()) { 
     getView().setLayerType(View.LAYER_TYPE_SOFTWARE, null); 
} 

alors question semble pas, mais l'application traitera « lentement ». Sinon, des problèmes apparaissent à nouveau.

Ceci est l'ensemble du code de la vue où "nonAdParent" se trouve dans-framelayout.

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout  
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/white_blur" 
    android:clipChildren="true" 
    android:clipToPadding="false" 
    android:fitsSystemWindows="true"> 

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

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

    <com.google.android.gms.ads.AdView 
     android:id="@+id/adView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     ads:adSize="SMART_BANNER" 
     ads:adUnitId="ca-app-pub-3940256099942544/6300978111"/> 

    <FrameLayout 
     android:id="@+id/adParent" 
     android:layout_width="match_parent" 
     android:layout_height="20dp" 
     android:visibility="gone" /> 

    <FrameLayout 
     android:id="@+id/nonAdParent" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/white_blur"> 

     <FrameLayout 
      android:id="@+id/collage_view_container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@color/white_blur" 
      android:layout_marginBottom="@dimen/collageview_margin" /> 

     <FrameLayout 
      android:id="@+id/menu_footer" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom" 
      android:background="@color/colorSecondary" /> 
    </FrameLayout> 

P.S. S'il vous plaît dites si plus de code nécessaire. Merci d'avance.

+0

FrameLayout doit être utilisé pour maintenir une seule vue de l'enfant, car il peut être difficile d'organiser des vues des enfants d'une manière qui est évolutive à différents tailles d'écran sans que les enfants ne se chevauchent. Vous devez donc utiliser la mise en page relative comme mise en page parente au lieu de la mise en page du cadre. –

+0

@sunilkushwah merci; J'essaie d'utiliser RelativeLayout pour la mise en page parente au lieu de FrameLayout, mais cela ne fonctionne PAS. –

+0

pouvez-vous partager ce code où vous avez utilisé la mise en page relative –

Répondre

0

Remplacez votre mise en page du cadre (nonAdParent) partie avec le code ci-dessous

<RelativeLayout 
     android:id="@+id/nonAdParent" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/white_blur"> 

     <FrameLayout 
      android:id="@+id/collage_view_container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@color/white_blur" 
      android:layout_alignParentTop="true" 
      android:layout_marginBottom="@dimen/collageview_margin" /> 

     <FrameLayout 
      android:id="@+id/menu_footer" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom" 
      android:layout_below="@+id/collage_view_container" 
      android:background="@color/colorSecondary" /> 
    </RelativeLayout> 
+0

J'ai essayé votre code mais ça ne marche pas :( –