像这样我没有错误,应用程序布局加载得很好但没有Admob横幅显示...
package com.appsclamation.justatestadmob;
import android.app.Activity;
import android.os.Bundle;
import com.phonegap.*;
public class DefaultActivity extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.setIntegerProperty( "splashscreen", R.drawable.splash );
super.loadUrl("file:///android_asset/www/index.html", 3000);
}
}
像这样没有显示应用布局,但Admob横幅显示......
package com.appsclamation.justatestadmob;
import android.app.Activity;
import android.os.Bundle;
import com.google.ads.*;
public class DefaultActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Look up the AdView as a resource and load a request.
AdView adView = (AdView)this.findViewById(R.id.adView);
adView.loadAd(new AdRequest());
}
}
像这样没什么,它会在装载时关闭......
this.setContentView(R.layout.detail); < - 当我在i中添加时出现此错误 - 细节无法解析或不是字段DefaultActivity.java - >当我把它拿出来没有错误,但在加载时崩溃说抱歉,意外强制关闭或类似的东西。
package com.appsclamation.justatestadmob;
import android.os.Bundle;
import com.google.ads.*;
import com.phonegap.*;
public class DefaultActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.detail);
setIntegerProperty( "splashscreen", R.drawable.splash );
loadUrl("file:///android_asset/www/index.html", 3000);
// Look up the AdView as a resource and load a request.
AdView adView = (AdView)this.findViewById(R.id.adView);
adView.loadAd(new AdRequest());
}
}
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.appsclamation.justatestadmob"
android:versionCode="1"
android:versionName="1.0" >
<meta-data android:value="true" android:name="ADMOB_ALLOW_LOCATION_FOR_ADS" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="18" />
<application
android:label="@string/app_name" >
<activity
android:name=".DefaultActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|
screenLayout|uiMode|screenSize|s mallestScreenSize" />
</application>
</manifest>
主要
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="320dp"
android:layout_height="50dp" >
android:orientation="vertical" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="a15234a17b883f6"
/>
我需要你的帮助,请不要错过任何一个,但我需要得到它,以便应用程序布局和广告同时显示。我稍后会找出应用程序启动器Icon。
Thanks