Created
January 12, 2022 18:23
-
-
Save ahmmedrejowan/87165fa3435a335df0407d8e03e47d7e to your computer and use it in GitHub Desktop.
Adview Not Overlapping MainViews
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<ScrollView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_above="@+id/adView" | |
android:layout_alignParentTop="true"> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<!-- All Other Layout and files--> | |
</LinearLayout> | |
</ScrollView> | |
<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" | |
ads:adSize="BANNER" | |
ads:adUnitId="ca-app-pub-3940256099942544/6300978111"/> | |
</RelativeLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The main idea is to reserve space for the ad layout. Relative layout makes it easier. Put everything in a parent layout inside scroll view and put the scrollview above the adlayout. That's it.