2

タブ付きアクティビティ内のすべてのフラグメントのバナーを追加したいと思います.Bannerはページの下部で一定になります。タブ付きアクティビティにバナーを追加する

私のプロジェクトには8ページあります。私はすべてのフラグメントに1つずつバナーを追加できます。しかし、この方法では、すべてのフラグメントに対して8つのバナーを追加する必要があります。私はそれを望んでいません。一番下のすべての断片に助けのための

感謝:)

enter image description here

ここでは私のmain_activity.xmlです。

<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" 
    xmlns:ads="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/main_content" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.example.aslan.rte3.MainActivity"> 




    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:paddingTop="@dimen/appbar_padding_top" 
     android:theme="@style/AppTheme.AppBarOverlay" 
     android:background="@android:color/black"> 

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

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


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

    </android.support.v4.view.ViewPager> 






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

答えて

1

はこの1

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

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

    <FrameLayout 
     android:id="@+id/banner_layout" 
     android:layout_width="match_parent" 
     android:layout_height="50dp"> 
     <!-- put your banner here --> 
    </FrameLayout> 
</LinearLayout> 
+0

ことで、この1

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

を交換するようにしてください私は私のscreen.Frameレイアウトに空白のページがこれをしなかったが、私にそのいけない仕事、そのショーであります常にトップに、私はその位置を変更することはできません。そしてコンソールは言う;広告を表示するのに十分なスペースがない。 320x50 dpが必要ですが、320x0 dpしかありません。 – metomero

+0

アクティビティのレイアウトを教えてください。 – MaxV

+0

質問にxlmファイルを追加しました – metomero

関連する問題