2017-06-09 1 views
0

J'essaie de placer une annonce en bas de l'écran. Il y a un viewpager défilant qui devrait être à l'envers de la bannière publicitaire. ils sont plutôt chevauchent:Mettez LinearLayout avec une bannière publicitaire en bas de l'écran

enter image description here

Ainsi, les annonces sont derrière le viewpager de défilement avec RecyclerView ...

c'est le code de mise en page:

<android.support.design.widget.CoordinatorLayout 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"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

     <include 
      layout="@layout/toolbar_main"/> 
     <RelativeLayout 

      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      app:layout_scrollFlags="scroll|enterAlways"> 

      <ImageView 
       android:id="@+id/tabImage" 
       android:layout_width="100dp" 
       android:layout_height="150dp" 
       android:scaleType="centerCrop" 
       android:layout_centerHorizontal="true" 
       /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Anime Title" 
       android:id="@+id/tabTitle" 
       android:layout_below="@id/tabImage" 
       android:layout_centerHorizontal="true" 
       android:gravity="center"/> 

     </RelativeLayout> 

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

    </android.support.design.widget.AppBarLayout> 

    <LinearLayout xmlns:ads="http://schemas.android.com/apk/res-auto" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center|bottom" 
     android:background="#000000" 
     android:orientation="vertical"> 

     <com.google.android.gms.ads.AdView 
      android:id="@+id/adView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal|center" 
      android:layout_alignParentBottom="true" 
      android:layout_centerHorizontal="true" 
      ads:adSize="BANNER" 
      ads:adUnitId="@string/banner"> 
     </com.google.android.gms.ads.AdView> 

    </LinearLayout> 

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

</android.support.design.widget.CoordinatorLayout> 

Ce que je fais mal ?

Cordialement,

Répondre

0

Essayez cette mise en page:

<android.support.design.widget.CoordinatorLayout 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"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

     <include 
      layout="@layout/toolbar_main"/> 
     <RelativeLayout 

      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      app:layout_scrollFlags="scroll|enterAlways"> 

      <ImageView 
       android:id="@+id/tabImage" 
       android:layout_width="100dp" 
       android:layout_height="150dp" 
       android:scaleType="centerCrop" 
       android:layout_centerHorizontal="true" 
       /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:text="Anime Title" 
       android:id="@+id/tabTitle" 
       android:layout_below="@id/tabImage" 
       android:layout_centerHorizontal="true" 
       android:gravity="center"/> 

     </RelativeLayout> 

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

    </android.support.design.widget.AppBarLayout> 

    <LinearLayout xmlns:ads="http://schemas.android.com/apk/res-auto" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="#000000" 
     android:orientation="vertical"> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/viewpager" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"/> 

     <com.google.android.gms.ads.AdView 
      android:id="@+id/adView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal|center" 
      android:layout_alignParentBottom="true" 
      android:layout_centerHorizontal="true" 
      ads:adSize="BANNER" 
      ads:adUnitId="@string/banner"> 
     </com.google.android.gms.ads.AdView> 

    </LinearLayout> 
</android.support.design.widget.CoordinatorLayout> 
+0

Je viens d'ajouter et la ViewPager dissapeared – emboole

+0

J'ai fait quelques changements. Veuillez réessayer. –