1. 方法1:AndroidManifest.xml 里,Activity的 android:theme 指定为" @android:style/Theme.NoTitleBar.Fullscreen"
示例:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme=" @android :style/Theme.NoTitleBar.Fullscreen">
<activity
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
2. 方法2: 在onCreate()里指定No title
要加入:
/*set it to be no title*/
requestWindowFeature(Window.FEATURE_NO_TITLE);
/*set it to be full screen*/
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
示例:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/*set it to be no title*/
requestWindowFeature(Window.FEATURE_NO_TITLE);
/*set it to be full screen*/
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
[Android]设置Activity为全屏显示的两种方法
原创
©著作权归作者所有:来自51CTO博客作者dcj3sjt126com的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
SpringBoot优雅捕捉异常的两种方法
SpringBoot优雅捕捉异常的两种方法
SpringBoot 异常处理 @ControllerAdvice @ExceptionHandler -
android 两种设置全屏的activity方式
第一种是在我们的代码中进行设置,如下两行代码即可:
android 全屏 xml 测试开发 bundle -
android activity全屏 android设置全屏显示
在实际的应用程序开发中,我们有时需要把 Activity 设置成全屏显示,一般情况下,可以通过两种方式来设置全屏显示效果。其一,通过在代码中可以设置,其二,通过manifest配置文件来设置全屏。 其一:在代码中设置(如下)public void onCreate(Bundle
android style 全屏 Android 全屏 Error No resource found