weixin_42502282
2012-11-23 14:11
浏览 315

点击完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); :( :(
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"?>
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent">
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"   
    />
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • gundumw100 2012-11-23 16:43
    已采纳

    检查焦点是否在View上!

    点赞 评论

相关推荐 更多相似问题