嘿,我最近在我的应用中添加了一个广告横幅
在我添加之后一切正常......直到我旋转手机然后应用程序崩溃
我将以下代码添加到原始应用代码中: 在我的家庭片段中,
On create view:
...
mAdStatus = (TextView) v.findViewById(R.id.status);
mAdView = (AdView) v.findViewById(R.id.ad);
mAdView.setAdListener(new MyAdListener(mAdStatus));
AdRequest adRequest = new AdRequest();
adRequest.addKeyword("sporting goods");
mAdView.loadAd(adRequest);
return v;
xml中的:
<LinearLayout
android:id="@+id/ad_catalog_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView android:id="@+id/status"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"
android:text="" />
<com.google.ads.AdView xmlns:googleads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
googleads:adSize="SMART_BANNER"
googleads:adUnitId="@string/admob_id" />
我应该打电话给销毁并做点什么吗?
感谢您的帮助
答案 0 :(得分:0)
问题解决了。
问题是我忘了将xml代码放在layout-land xml中。
谢谢:)