Android开发教程:斗地主 [牌桌实现源码]
Android开发教程:斗地主 [牌桌实现源码]
发一个Android斗地主游戏的牌桌实现。
为了节约内存资源,每张扑克牌都是剪切形成的,当然这也是当前编程的主流方法。
1、主Activity
- package com.bison;
- import android.app.Activity;
- import android.content.pm.ActivityInfo;
- import android.os.Bundle;
- import android.view.Window;
- import android.view.WindowManager;
- /**
- * 求某公司包养
- *
- * @author Bison
- *
- */
- public class PukeActivity extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- // 这个事隐藏标题栏,不解释
- requestWindowFeature(Window.FEATURE_NO_TITLE);
- // 隐藏状态栏,你懂的
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
- /*
- * 开始有考虑使屏幕上扑克的排列随屏幕的分辨率变动 结果貌似不好做,注释掉了 Display display =
- * getWindowManager().getDefaultDisplay(); int screenWidth =
- * display.getWidth(); int screenHeight = display.getHeight();
- */
- // 使用代码锁定横屏
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
- // setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);这个是竖屏
- setContentView(new GameView(this));
- }
- }
|
评论暂时关闭