나는이 오류를 해결할 수 없습니다. 나는 구글을 둘러 보았고 아무런 해결책도 없었다. 내 광고는 Android 1.5 및 1.6에서 제대로 작동하는 것으로 보이지만 버전 2 이상에서는 오류가 발생합니다."첫 번째 레이아웃 이후 viewWidth를 가져올 수 없습니다."오류
스크롤 뷰 내부의 첫 번째 레이아웃 인 LinearLayout 안에 광고를 배치했습니다.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:background="@drawable/bg_wallpaper"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:id="@+id/drillactivity"
android:layout_width="fill_parent"
android:layout_gravity="bottom"
android:layout_height="340dp">
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="my id goes here"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>
광고용 클래스를 사용하고 있지 않습니다. 나는 XML을 통해서만 그것을하는 것을 선호한다.
loadAdOnCreate의 기능은 무엇입니까? 내 경우에는 다음과 같은 경고가 발생했습니다. "광고가 이미로드되어있는 동안 loadAd가 호출되어 중단됩니다." –
loadAdOnCreate는 onCreate에서 광고를로드합니다. 따라서 onCreate에서 개별적으로 광고 요청을 보낼 필요가 없습니다. – asish