2

I want to add a banner for all fragments in my Tabbed Activity.Banner will be constant at bottom of the page.

I have 8 page in my project, i can add a banner one by one to all fragments.But at this method, i have to add 8 banner for all fragments.I do not want it.I want a constant banner upon all fragments at the bottom.

Thanks for help :)

enter image description here

here is my 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>
metomero
  • 63
  • 1
  • 11

1 Answers1

1

Try to replace this one

<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>

by this one

<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>
MaxV
  • 2,601
  • 3
  • 18
  • 25
  • i did this, but its dont work on me, its shows blank page on my screen.Frame layout is always on the top, i can not change its position. And console says ;Not enough space to show ad. Needs 320x50 dp, but only has 320x0 dp. – metomero Feb 12 '17 at 13:41
  • Can you please provide your activity's layout? – MaxV Feb 12 '17 at 15:41
  • i have added my xlm file to question – metomero Feb 12 '17 at 16:30
  • OMG !!! its worked :) I respect you very much sir.:):):) Please accept my gratitude thanks. – metomero Feb 12 '17 at 19:01