代码如下:
package com.android.tutor;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class OpenGl_Lesson1 extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//无title
requestWindowFeature(Window.FEATURE_NO_TITLE);
//全屏
getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN , WindowManager.LayoutParams. FLAG_FULLSCREEN);
//此两段代码必须设置在setContentView()方法之前
setContentView(R.layout.main);
}
}
二、在配置文件中设置(android:theme="@android:style/Theme.NoTitleBar.Fullscreen"):
代码如下:
?xml version="1.0" encoding="utf-8"?
manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.tutor"
android:versionCode="1"
android:versionName="1.0"
application android:icon="@drawable/icon" android:label="@string/app_name"
activity android:name=".OpenGl_Lesson1"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:label="@string/app_name"
intent-filter
action android:name="android.intent.action.MAIN" /
category android:name="android.intent.category.LAUNCHER" /
/intent-filter
/activity
/application
uses-sdk android:minSdkVersion="7" /
/manifest
建议使用第二种方法!