1

The admob work fine where the device's width 320 but smaller than that it will not display.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/layout_adsmob"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:background="#00ffffff"
android:visibility="gone" >

<com.google.ads.AdView
    android:id="@+id/adsmob"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ads:adSize="SMART_BANNER"
    ads:adUnitId="MY_AD_UNIT_ID"
    ads:loadAdOnCreate="true"
    ads:testDevices="TEST_EMULATOR,TEST_DEVICE_ID" />

4

1 回答 1

1

您将根元素的可见性设置为gone。在 XML 文件中设置任何元素的可见性也会隐藏标记的子元素。

只是根本不设置可见性。默认为VISIBLE,因此无需手动设置

如果这是有意的,并且您希望在加载广告之前使其不可见,请以编程方式更改可见性:

someView.setVisibility(View.VISIBLE);
于 2016-07-04T10:53:36.673 回答