2015-02-23 55 views
0

我相信我有最獨特和最奇怪的問題。Admob將所有內容壓縮(包括窗口)!

因此,要保持它的簡單我已經制造了世界上最簡單的佈局:

<?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:ads="http://schemas.android.com/apk/res-auto" 
     android:layout_width="match_parent" 
android:background="#4d9345" 
     android:layout_height="match_parent" > 


     <com.google.android.gms.ads.AdView 
      android:id="@+id/adView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_alignParentTop="true" 
      ads:adSize="BANNER" 
      ads:adUnitId="@string/admob"> 
     </com.google.android.gms.ads.AdView> 

     <Button 
      android:id="@+id/button1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_alignParentLeft="true" 
      android:text="Button" /> 

    </RelativeLayout> 

然後代碼:

protected void onCreate(Bundle savedInstanceState) { 
    // TODO Auto-generated method stub 
    super.onCreate(savedInstanceState); 
    requestWindowFeature(Window.FEATURE_NO_TITLE); 

    Window window = getWindow(); 
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 
    window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); 
    window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); 
    window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); 



    setContentView(R.layout.myact); 


    AdView mAdView = (AdView) findViewById(R.id.adView); 
    AdRequest.Builder adRequest = new AdRequest.Builder(); 
    AdRequest req = adRequest.build(); 
    mAdView.loadAd(req); 

} 

場景1:

如果我按下啓動此活動的按鈕啓動此活動,一切正常。活動說明預期(PIC下):

enter image description here

方案2:

如果此活動與屏幕關閉廣播接收器開始,它攪亂了佈局,儘快在加載廣告。包括窗口在內的所有內容都被壓下。 (如下圖):

enter image description here

你可以看到,即使其母公司(相對佈局)被推下來(正如你所看到的廣告上方是黑色的差距)。

場景3:

如果我做一些改變的XML佈局代碼ANA給AdMob中查看的保證金頂:

android:layout_marginTop="25dp" 

的結果是,內容不下推:

enter image description here

注意事項:

  1. 此活動在某些情況下啓動,但僅在屏幕關閉時啓動。

  2. 如果我不使用requestWindowFeature(Window.FEATURE_NO_TITLE);在我的代碼中,它沒有問題,但使用此功能是非常棘手的。

爲了使這個問題更奇怪: 3.做到這一點只在三星Galaxy S3迷你。它在HTC One,HTC Wildfire和其他一些沒有問題的情況下工作。 (但也許有些設備完全可以在Galaxy S3 mini上使用)。 4.我只在Admob和Leadbolt廣告上體驗過這種行爲。使用亞馬遜,Mmedia,甚至我自己的廣告(從我的服務器拉),它的工作沒有任何問題..

即使壽我不期望,因爲這是最奇怪的問題,我真的appriciate一些幫助..

預先感謝您。

+0

你的設備運行的是什麼版本的android? 通知欄在KitKat上工作不同(您實際上不能隱藏它) – 2015-02-23 13:14:20

+0

有問題的設備(Galaxy s3 mini)運行4.1.2。宏達野火(偉大的工程)運行較舊的2.3.5,和HTC One運行4.4.2(很好)。 – rootpanthera 2015-02-23 13:20:33

+1

嗯,不知道發生了什麼,但看看這篇文章。它提到了一些錯誤,另一個答案有一些標誌,可能會爲你工作http://stackoverflow.com/questions/3074398/android-status-bar-prevents-full-screen – 2015-02-23 13:36:07

回答

相關問題