我已经添加了添加暴徒横幅到我的活动,它正在按预期工作。只有一件事是错误的,它不是在前面显示而是在后台显示。我希望把它带到前面,但我无法这样做。
这是我的XML文件:
<com.sothree.slidinguppanel.SlidingUpPanelLayout
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"
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:clipChildren="false"
android:descendantFocusability="blocksDescendants"
android:gravity="bottom"
app:umanoClipPanel="false"
app:umanoOverlay="true"
app:umanoPanelHeight="@dimen/sliding_panel_height"
app:umanoShadowHeight="4dp"
tools:ignore="MissingPrefix">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent">
<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_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:addStatesFromChildren="true"
android:visibility="visible"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111"></com.google.android.gms.ads.AdView>
</RelativeLayout>
<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/wallpaper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone" />
<ImageView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|start"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/content_margin"
android:theme="@style/RippleStyleLight" />
</FrameLayout>
<RelativeLayout
android:id="@+id/bottom_panel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66000000"
android:clipToPadding="false"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/sliding_panel_height"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingBottom="@dimen/content_padding"
android:paddingEnd="@dimen/content_margin"
android:paddingLeft="@dimen/content_margin"
android:paddingRight="@dimen/content_margin"
android:paddingStart="@dimen/content_margin"
android:paddingTop="@dimen/content_padding">
<TextView
android:id="@+id/name"
fontPath="fonts/Font-Medium.ttf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textSize="@dimen/text_content_title" />
<TextView
android:id="@+id/author"
fontPath="fonts/Font-Regular.ttf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textSize="@dimen/text_content" />
</LinearLayout>
<ImageView
android:id="@+id/menu_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/content_margin"
android:theme="@style/RippleStyle" />
<ImageView
android:id="@+id/menu_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/content_margin"
android:theme="@style/RippleStyle"
android:visibility="gone" />
<ImageView
android:id="@+id/menu_apply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/content_margin"
android:theme="@style/RippleStyle" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/top_bar"
android:clipToPadding="false" />
</RelativeLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
我放置AdView
的位置并不重要,它始终显示在后面而不是前面。
我正试图在关闭壁纸屏幕上添加admob横幅。
我在活动前面添加了横幅是qazxsw poi
此代码显示如何在活动中显示横幅。它对我有用
XML code
I am trying to add banner at the bottom of the wallpaper.
此代码添加到清单文件中
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_home_footer"
android:layout_height="wrap_content" />
**此代码添加Java文件**
<manifest>
<application>
<!-- AdMob App ID: ca-app-pub-XXXXXXXXXXXXXXXXXXXXXXXXX -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB_APP_ID]"/>
</application>