[英]Admob ad under a view
I want to add an admob ad under a view so it will be hided. 我想在视图下添加admob广告,以便将其隐藏。
So admob still acts as it's showing ? 因此,admob仍会像显示的那样起作用吗?
<view hidden>
<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">
</view>
https://developers.google.com/admob/android/quick-start https://developers.google.com/admob/android/quick-start
you can use FrameLayout for laying views on top of each other, for example see below code : 您可以使用FrameLayout在彼此之上放置视图,例如,参见下面的代码:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<View
android:layout_width="120dp"
android:layout_height="120dp"
android:background="#000000"
android:layout_gravity="center"
android:id="@+id/hiddenView"
/>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:id="@+id/topView"
/>
</FrameLayout>
in this layout the second view (the view with white background called topView) is on top, and first view (the view with black background called hiddenView) goes behind second view 在此布局中,第二个视图(带有白色背景的视图称为topView)位于顶部,而第一个视图(带有黑色背景的视图称为hiddenView)位于第二个视图之后
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.