我在现有项目中创建了一个admob横幅。在相对布局中,我正在调用FrameLayout并在admob横幅的代码下方。但是问题是Admob标语显示在框架布局内容上方。
我的XML代码如下
<?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"
xmlns:ads="http://schemas.android.com/apk/res-auto">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"/>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/banner_home_footer"
ads:background="@color/theme_ads"
android:layout_alignParentBottom="true">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
根据admob政策,我们不应将广告置于内容之上。我该如何解决这个问题?
我正在创建一个应用程序,它在中心有一个 ImageButton。问题是即使图像是纯 PNG 格式,我也没有在图像按钮内获得透明图像。
我的 Xml 如下
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns: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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="switchmode.lteonly.lteonlyswitch.MainActivity"
tools:showIn="@layout/app_bar_main">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton"
android:clickable="true"
android:layout_centerVertical="true"
android:layout_centerInParent="true"
android:src="@drawable/myimage"
android:onClick="onClick"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
输出布局如下。
任何想法如何解决这个问题?