Android-SmartWebView
Android-SmartWebView copied to clipboard
Admob Banner After Webview
Hi,
Thanks for great code, I'm using webview on my website but issue is. I Want admob banner in bottom But it overlap bottom menu. I tried marginBottom and Padding bottom Nothing works.
activity_main.xml
` <androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pullfresh" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="0dip" android:paddingRight="0dip" android:paddingTop="0dip" android:paddingBottom="0dip" tools:context="MainActivity" android:background="@color/colorPrimary">
<RelativeLayout
android:id="@+id/msw_welcome"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
android:gravity="center_vertical|center_horizontal|center"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
tools:ignore="RtlHardcoded">
<ImageView
android:id="@+id/msw_logo"
android:layout_width="275dip"
android:layout_height="100dip"
android:src="@raw/front_splash"
android:gravity="center_vertical|center_horizontal|center"
android:contentDescription="@string/image_view"
android:layout_gravity="top"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/msw_loading_text"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal|center"
android:layout_width="match_parent"
tools:ignore="NotSibling"
android:text="@string/app_name"
android:textSize="18sp"
android:textStyle="normal|bold"
android:textColor="?android:attr/textColorTertiary"
android:layout_marginTop="26dp"
android:layout_below="@+id/msw_logo"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal|center"
android:layout_width="match_parent"
tools:ignore="NotSibling"
android:text="@string/mgks_promo"
android:textSize="18sp"
android:textStyle="normal|bold"
android:textColor="@color/lightblack"
android:layout_below="@+id/msw_loading_text"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="120dp" />
</RelativeLayout>
<WebView
android:id="@+id/msw_view"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:visibility="gone" />
<WebView
android:id="@+id/print_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone" />
<ProgressBar
android:id="@+id/msw_progress"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="fill_parent"
android:layout_height="10dip"
android:layout_gravity="bottom"
android:progressDrawable="@drawable/progress_style"
android:layout_centerInParent="true"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="false"
android:visibility="visible" />
<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/msw_ad_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="false"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.AdView>
`
Example like this https://i.stack.imgur.com/TJstI.jpg
I want after the webview show it doesn't interrupt website.
Thank you
hey there you need to remove this in you xml code because that is showing the ad ->>
<com.google.android.gms.ads.AdView>
@InsertCart if you don't need it, better would be to remove the tag as @Batsirai-sudo has suggested.
As for the solution, I think you've already went through this - https://stackoverflow.com/questions/32497840/how-to-hide-ad-banner-when-opened-keyboard-on-android
@mgks Yes I already went through that article,
When I add code in footer :-
If I add padding or margin to layout 50dip
and -50dip to admob code it hide behind it. as you can see in image below
I there any way I can make padding 50dip to layout and admob code just after that so it will not interfere.