Android 台灣中文網

標題: 點擊完admob廣告條按下返回鍵時遊戲沒回應..!? [打印本頁]

作者: asue    時間: 2012-11-22 03:16
標題: 點擊完admob廣告條按下返回鍵時遊戲沒回應..!?
玩player上別人的app點擊完廣告後按下手機back鍵,遊戲還好好的在等你回來繼續...我的app卻是按完廣告返回遊戲時已經沒有回應...是不是少寫了什麼....

//-----Activity

package asue.game;

import android.os.Bundle;
import android.app.Activity;
import android.view.Window;
import android.view.WindowManager;
import android.content.pm.ActivityInfo;
import android.util.DisplayMetrics;

  public class MainActivity extends Activity {

          public static float vWidth;
          public static float vHeight;
  /** Called when the activity is first created. */
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
                setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); //螢幕切換 ctrl+f12
                getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,   WindowManager.LayoutParams.FLAG_FULLSCREEN);
                requestWindowFeature(Window.FEATURE_NO_TITLE);                             
       setContentView(R.layout.main);
      
       DisplayMetrics dm = new DisplayMetrics();      
       this.getWindowManager().getDefaultDisplay().getMetrics(dm); //取得裝置的資訊
       vWidth = dm.widthPixels;//寬
       vHeight = dm.heightPixels; //高      
   
  }

  /** Called before the activity is destroyed. */
  @Override
  public void onDestroy() {  
      super.onDestroy();      
  }

  }

//-------------main

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <asue.game.Panel
        android:id="@+id/mainPanel"
        android:layout_width="match_parent"
        android:layout_height="match_parent"         
        android:layout_below="@+id/adView"   
          android:layout_gravity="top"  
          android:layout_alignParentTop="true"      
        />
      
   <com.google.ads.AdView
        android:id="@id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
      
        ads:adSize="BANNER"
        ads:adUnitId="a1234567890"
        ads:loadAdOnCreate="true"  
        android:layout_alignParentBottom="true"   
        />

</RelativeLayout>
作者: apple321    時間: 2013-3-25 13:39
好可愛!下載試試看!
作者: apple321    時間: 2013-3-25 13:40
好可愛!下載試試看!
作者: gailda    時間: 2013-4-12 21:35
想學想學
下來看看
多謝大大分享
作者: a999123123    時間: 2013-6-13 17:23
多謝大大分享^^
作者: darkee    時間: 2013-8-8 10:55
多謝大大分享




歡迎光臨 Android 台灣中文網 (https://apk.tw/) Powered by Discuz! X3.1