2012-03-09 18 views

答えて

2
import com.google.ads.*; 


    public class testActivity extends Activity { 
      private static final String MY_AD_UNIT_ID = "yourId"; 
      private AdView adView; 

     @Override 
     public void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      super.loadUrl("file:///android_asset/www/index.html");   
     // Create the adView 
        adView = new AdView(this, AdSize.BANNER, MY_AD_UNIT_ID); 
        LinearLayout layout = super.root; // this is the only change 
        layout.addView(adView); 
        adView.loadAd(new AdRequest()); 


    Xml File: 
     <com.admob.android.ads.AdView 
       android:id="@+id/ad" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       xmlns:backgroundColor="#000000" 
       xmlns:primaryTextColor="#ffffff" 
       xmlns:secondaryTextColor="#cccccc" 
0

すべてのレイアウトにタグを含めましたか?

<com.admob.android.ads.AdView 
     android:id="@+id/ad" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     xmlns:backgroundColor="#000000" 
     xmlns:primaryTextColor="#ffffff" 
     xmlns:secondaryTextColor="#cccccc" 
    /> 
関連する問題