更新时间:2023-11-18 23:48:10
您电网正在与 layout_height =FILL_PARENT所有的空间。
您可以使用 layout_weight =1和 layout_height =0dp告诉电网为占用所有剩余的空间后,其它视图显示。
You can use layout_weight="1" and layout_height="0dp" to tell the grid to take up all the remaining space after other views are shown.
另外要补充的编程AD浏览?你可以将其放置在GridView控件下面的XML。
Also are you adding the AdView programmatically? You can place it in the xml below the GridView.
例如:
<LinearLayout 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"
android:background="@drawable/background_img"
android:orientation="vertical"
android:id="@+id/atozlayout"
>
<GridView
android:id="@+id/gridView1"
android:numColumns="auto_fit"
android:columnWidth="55dp"
android:stretchMode="columnWidth"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:horizontalSpacing="10dp"
android:verticalSpacing="10dp">
</GridView>
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adUnitId="MY_AD_UNIT_ID"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
ads:loadAdOnCreate="true"/>
</LinearLayout>
请确保您与您的值替换adUnitId。
Make sure you replace adUnitId with your value.