我在我的应用程序中使用广告.当模拟器在纵向模式下工作时工作正常但是当我将模拟器转换为横向模式时,即使我已经给出了android:layout_width ="match_parent",它也会填充水平屏幕.请告诉我如何解决这个问题.
这是xml文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world"
/>
<com.google.ads.AdView
android:id="@+id/ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="a1501e5633125fb"
ads:loadAdOnCreate="true"
ads:testDevices="TEST_EMULATOR, 123456789ABCDEF" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)