1
我想讓廣告顯示在屏幕左上角的預覽中,它位於應該顯示在應用中的位置運行。有人知道爲什麼嗎?Admob橫幅未放置在相對佈局中時出現
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_img);
AdView adView = (AdView)this.findViewById(R.id.adView);
adView.loadAd(new AdRequest());
}
<RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="2"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/imageView"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:layout_alignBottom="@+id/imageButton4"
android:layout_alignParentLeft="true"/>
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="xxxxxxx"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"
android:layout_alignParentTop="true" android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/imageButton"/>
<ImageButton
android:layout_width="70dp"
android:layout_height="70dp"
android:scaleType="fitCenter"
android:onClick="exit"
android:background="@null"
android:id="@+id/imageButton"
android:src="@drawable/deletebuttonbar2"
android:layout_alignParentTop="true" android:layout_alignParentRight="true"/>
<ImageButton
android:layout_width="70dp"
android:layout_height="70dp"
android:scaleType="fitCenter"
android:onClick="save"
android:background="@null"
android:src="@drawable/savebuttonbar3"
android:id="@+id/imageButton2"
android:layout_alignBottom="@+id/imageButton4" android:layout_toLeftOf="@+id/imageButton4"/>
<ImageButton
android:layout_width="72dp"
android:layout_height="72dp"
android:onClick="send"
android:scaleType="fitCenter"
android:background="@null"
android:src="@drawable/share"
android:id="@+id/imageButton3"
android:layout_alignParentBottom="true" android:layout_toRightOf="@+id/imageButton4"/><![CDATA[
android:layout_height="wrap_content" android:layout_toLeftOf="@+id/imageButton">
]]>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:id="@+id/imageButton4"
android:onClick="filter"
android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:paddingRight="10dp"/>
</RelativeLayout>