Android全屏设置
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class FullScreenExp extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//全屏设置:
//1.设置隐去状态栏部分,包括电池等图标,
//2.无疑就是把我们应用的名字也隐去不显示,这样一来就全屏了
//注意: 隐去标题(应用的名字) 此设定必须要写在setContentView之前,否则会有异常!
//隐去电池等图标和一切修饰部分(状态栏部分)
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// 隐去标题栏(程序的名字)
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
}
}
另外:
设置横竖屏也可以在AndroidManifest.xml中定义: android:theme="@android:style/Theme.NoTitleBar" 隐去标题栏 android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 隐去状态栏
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".SimpleGraph"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
更多相关文章
- android - Shader 着色器 翻译
- Android(安卓)听筒播放 适配(摩托)
- 调用Android系统设置项
- android MediaRecorder录音详解
- Android—文字轮播
- Android(安卓)自定义dialog 设置宽度
- Android(安卓)Progressbar进度条显示
- Android(安卓)4.4 上实现透明导航栏和状态栏 Translucent system
- Android闹钟设置