我想改变admob的位置。我试图将我的admob代码移到我的相对布局的顶部,但遗憾的是你的应用程序已关闭。那我怎么能这样做呢。谢谢你的建议
xml代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<FrameLayout
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/card_show_stick_height_without_shadow" />
<ProgressBar
android:id="@+id/web_view_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="3dp"
android:layout_alignParentTop="true"
android:background="@drawable/progress_bar_status"
android:indeterminateOnly="false"
android:max="100" />
<View
android:id="@+id/web_view_buttons_divider"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="@drawable/ad_bottom_sticky_uppershadow" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/card_show_stick_height"
android:background="@android:color/black" >
<ImageButton
android:id="@+id/web_view_btn_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:background="@android:color/transparent"
android:paddingLeft="@dimen/web_view_margin_1"
android:paddingRight="@dimen/web_view_margin_2"
android:src="@drawable/stick_btn_back" />
<ImageButton
android:id="@+id/web_view_btn_forward"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/web_view_btn_back"
android:background="@android:color/transparent"
android:paddingRight="@dimen/web_view_margin_3"
android:src="@drawable/stick_btn_forward" />
<FrameLayout
android:id="@+id/web_view_lay_refresh"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/web_view_btn_forward"
android:paddingRight="@dimen/web_view_margin_4" >
<ImageButton
android:id="@+id/web_view_btn_refresh"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:src="@drawable/stick_btn_refresh"
android:visibility="invisible" />
<ProgressBar
android:id="@+id/loading"
style="?android:attr/progressBarStyleSmallInverse"
android:layout_width="@dimen/loading_spinner_size_small"
android:layout_height="@dimen/loading_spinner_size_small"
android:layout_gravity="center_vertical"
android:visibility="visible" />
</FrameLayout>
<ImageButton
android:id="@+id/web_view_btn_share"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/web_view_lay_refresh"
android:background="@android:color/transparent"
android:paddingRight="@dimen/web_view_margin_5"
android:src="@drawable/stick_btn_share" />
</RelativeLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-2128604123953452/6982779835" >
</com.google.android.gms.ads.AdView>
</LinearLayout>
- 这就是我所拥有的 -
- 这就是我想要的 -
答案 0 :(得分:1)
尝试:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<FrameLayout
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/card_show_stick_height_without_shadow" />
<ProgressBar
android:id="@+id/web_view_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="3dp"
android:layout_alignParentTop="true"
android:background="@drawable/progress_bar_status"
android:indeterminateOnly="false"
android:max="100" />
<View
android:id="@+id/web_view_buttons_divider"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="@drawable/ad_bottom_sticky_uppershadow" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/black" >
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-2128604123953452/6982779835" >
</com.google.android.gms.ads.AdView>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/card_show_stick_height"
android:background="@android:color/black" >
<ImageButton
android:id="@+id/web_view_btn_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:background="@android:color/transparent"
android:paddingLeft="@dimen/web_view_margin_1"
android:paddingRight="@dimen/web_view_margin_2"
android:src="@drawable/stick_btn_back" />
<ImageButton
android:id="@+id/web_view_btn_forward"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/web_view_btn_back"
android:background="@android:color/transparent"
android:paddingRight="@dimen/web_view_margin_3"
android:src="@drawable/stick_btn_forward" />
<FrameLayout
android:id="@+id/web_view_lay_refresh"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/web_view_btn_forward"
android:paddingRight="@dimen/web_view_margin_4" >
<ImageButton
android:id="@+id/web_view_btn_refresh"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:src="@drawable/stick_btn_refresh"
android:visibility="invisible" />
<ProgressBar
android:id="@+id/loading"
style="?android:attr/progressBarStyleSmallInverse"
android:layout_width="@dimen/loading_spinner_size_small"
android:layout_height="@dimen/loading_spinner_size_small"
android:layout_gravity="center_vertical"
android:visibility="visible" />
</FrameLayout>
<ImageButton
android:id="@+id/web_view_btn_share"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/web_view_lay_refresh"
android:background="@android:color/transparent"
android:paddingRight="@dimen/web_view_margin_5"
android:src="@drawable/stick_btn_share" />
</RelativeLayout>
</LinearLayout>