Try to search your question here, if you can't find : Ask Any Question Now ?

How to show admob at the top of screen?

HomeCategory: stackoverflowHow to show admob at the top of screen?
Avatarbhawya asked 4 weeks ago

I am trying to show webview of my own website, admob banner and progress bar.

In the below code, webview and progress bar, admob banner everything is working correctly. But, admob banner is showing at the bottom.

How can I show the admob banner at the top of screen?
I have tried to move the adview to the bottom, but it is showing blank screen.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
    android:layout_height="match_parent"
            android:background="@color/white"
    android:orientation="vertical" 
    tools:context="com.myapp.MainActivity">

    <com.google.android.gms.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/res-auto"
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"
            ads:adSize="SMART_BANNER"
            ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
        </com.google.android.gms.ads.AdView>

<LinearLayout
        android:layout_above="@id/adView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

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

    <WebView
        android:id="@+id/activity_main_webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    <ProgressBar
    android:id="@+id/progress1" style="?android:attr/progressBarStyleLarge"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

</RelativeLayout>
</LinearLayout>    
</RelativeLayout>
1 Answers
Best Answer
AvatarMatthias answered 4 weeks ago
Your Answer

14 + 2 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com