Show A Constant Admob Ad Banner In All The Activities
I am working on an android application, i have embedded admob ad at the bottom of each activity and its shows ad in all activities, but i want to show a constant admob ad in all th
Solution 1:
There is no way to do this. And as Ellis says you only want to display an ad where your user spends most of their time.
Solution 2:
Not sure if this will help you. Give this code a try. Also, if required, try using the child fragment approach to View Pager.
<?xml version="1.0" encoding="utf-8"?><RelativeLayoutxmlns: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:layout_width="match_parent"android:layout_height="match_parent"><android.support.v4.widget.DrawerLayoutandroid:id="@+id/drawer"android:layout_width="match_parent"android:fitsSystemWindows="true"android:layout_height="match_parent"android:layout_marginBottom="50dp"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><includeandroid:id="@+id/toolbar_actionbar"layout="@layout/toolbar_default"android:layout_width="match_parent"android:layout_height="wrap_content" /><FrameLayoutandroid:id="@+id/container21"android:layout_width="match_parent"android:clickable="true"android:layout_height="match_parent" /></LinearLayout>
< com.myapp.isgreat.ScrimInsetsFrameLayout android:id="@+id/scrimInsetsFrameLayout"
android:layout_width="@dimen/navigation_drawer_width" android:layout_height="wrap_content"
android:fitsSystemWindows="true" android:layout_gravity="start" app:insetForeground="#4000"
android:elevation="10dp">
<fragmentandroid:id="@+id/fragment_drawer"android:name="com.my.appisgreat.NavigationDrawerFragment"android:layout_width="@dimen/navigation_drawer_width"android:layout_height="match_parent"android:fitsSystemWindows="true"app:layout="@layout/fragment_navigation_drawer"tools:layout="@layout/fragment_navigation_drawer" /></com.myapp.isgreat.ScrimInsetsFrameLayout></android.support.v4.widget.DrawerLayout><com.google.android.gms.ads.AdViewandroid:id="@+id/adView"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerHorizontal="true"android:layout_alignParentBottom="true"ads:adSize="BANNER"ads:adUnitId="@string/banner_ad_unit_id"></com.google.android.gms.ads.AdView></RelativeLayout>
Hope this helps..! Happy Android development.!
Solution 3:
There may be one way to do this. But for that, you might need to completely restructure your app UI. You could keep one activity in your app, and convert all the actual activities into fragments. Then, you will just swap fragments inside the same single activity. I wouldn't recommend this though.
Post a Comment for "Show A Constant Admob Ad Banner In All The Activities"