2013-06-20 64 views
0

我的應用的屏幕看起來像this ScreenshotAndroid應用圖標和名稱在應用中多次出現

正如你所看到的我做了一個廣告應用(admob),但有一個錯誤,我不能修復。

代碼:

private AdView adView; 

@Override 
protected void onCreate(Bundle savedInstanceState) 
{ 
    super.onCreate(savedInstanceState); 

    setContentView(R.layout.activity_fullscreen); 

    //create adView 

    adView = (AdView) findViewById(R.id.adView); 

    AdRequest request = new AdRequest(); 
    adView.loadAd(request); 
} 

佈局:

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:id="@+id/linearlayout" 
    android:orientation="vertical"> 

<com.google.ads.AdView 
    android:id="@+id/adView" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    ads:adSize="BANNER" 
    ads:adUnitId="....." 
    ads:testDevices="....." > 
</com.google.ads.AdView> 

</LinearLayout> 

我在logcat中沒有錯誤信息和應用程序didnt崩潰。希望你能幫助! 我已經重新啓動手機並重新啓動了eclipse。

編輯:清單:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.stefan.game" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk 
    android:minSdkVersion="10" 
    android:targetSdkVersion="17" /> 

<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.stefan.game.FullscreenActivity" 
     android:configChanges="orientation|keyboardHidden|screenSize" 
     android:label="@string/app_name" 
     android:theme="@style/FullscreenTheme" > 
     <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|smallestScreenSize"/> 
</application> 
</manifest> 
+0

你能發表更多的信息嗎?這是完整的佈局xml嗎? // Ist das derVollständigeCode? zumindest是死的xml angeht ..? sehr // verwirrend .. –

+0

這是完整的xml // hi du kannst ja deutsch reden。 Ja das ist die ganze layout datei – user2502514

+0

can you show me the manifest.xml?並且activity_fullscreen是給定的佈局? // ja hab an der werbung gesehn dass du deutsch bist =)siewar zwar alles richtig aus aber hier nochmal ein tut .. btw。這裏是一個教程http://www.wikihow.com/Add-Advertisements-to-Your-Android-Applications-Using-Admob –

回答

0

你應該嘗試創建一個整數來計算廣告的實例。 首先看看你的整數是否優於1.

+0

如何計算我的廣告的實例? – user2502514

0

首先嚐試一個乾淨的版本。 IT可能是你正在使用錯誤的資源ID。

否則,請嘗試刪除您的應用和您的活動的主題屬性。如果您在上面提供的佈局XML是完整的XML,那麼我認爲您錯誤地配置了主題,以至於您要麼將列表或重複的背景合併到您的活動佈局中。

+0

thx很多。我創造了一切新東西,現在它可以工作。雖然我很確定它的代碼相同。 – user2502514

+0

就像我想的那樣,你已經部分構建了代碼。總是先嚐試一個乾淨的構建,它通常可以解決這些問題。並請將答案標記爲正確。 – William

相關問題