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 创建快捷图标demo
- Android P Launcher APP替换图标不随系统固定格式而改变
- Android 系统图标
- Android Studio Gradle多渠道打包(动态设定App名称,应用图标,背景
- Android MTK Launcher3安装三方apk,应用图标自动添加白边
- Android8.1 系统修改默认的wifi直连名字
- 海创软件组--20200712--Butterknife与自定义图标字体
- android imageswitcher gallery 根据数据库内图片名字进行查看/
- android 修改键盘enter图标,设置搜索等图标