我遇到以下布局的问题。布局非常简单,只需使用连续3个按钮的tablelayout(view = landscape)。但是,预览屏幕中存在“java.lang.NullPointerException”。我测试过并发现它来自广告部分,即。如果删除广告部分,则此java.lang.NullPointerException将消失。
我的问题是:
广告不支持横向广告吗?或者如何修改以下代码?
我也会采用interstitialAd。 interstitialAd也支持景观吗?
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
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:stretchColumns="*"
android:background="@drawable/bgd2" >
<TableRow
android:id="@+id/tableRow3"
android:layout_weight="0.5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/buttonA"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_span="4"
android:background="@drawable/green_btn"
android:onClick="buttonA_click"
android:text="1,2,3"
android:textSize="20dp" />
<Button
android:id="@+id/buttonB"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_span="4"
android:background="@drawable/blue_btn"
android:onClick="button_Email_click"
android:text="abc!"
android:textSize="20dp" />
<Button
android:id="@+id/buttonC"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_span="4"
android:background="@drawable/orange_btn"
android:onClick="buttonC_click"
android:padding="2dp"
android:text="Pictures!"
android:textSize="20dp" />
</TableRow>
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:background="@android:color/black"
android:text="Ads Unavailable"
android:textStyle="bold|italic"
ads:adUnitId="abc123"
ads:adSize="BANNER"
ads:refreshInterval="15000"
ads:loadAdOnCreate="true"/>
</TableLayout>
答案 0 :(得分:0)
机器人:screenOrientation = “风景”