There are 2 ways how to make an fullscreen activity. One from code other from AndroidManifest.xml. I am going to show both of them.
From code:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
...
At first we hide the title bar, then we make an activity fullscreen.
From AndroidManifest.xml:
<activity android:name=" "
...
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
under <activity>.
Both these variants make an fullscreen activity.
本文介绍如何在Android应用中创建全屏Activity,一种方式是通过代码在Activity的onCreate方法中设置,另一种是在AndroidManifest.xml文件中指定Theme。通过这两种方法可以有效地隐藏状态栏和标题栏,实现全屏效果。
505

被折叠的 条评论
为什么被折叠?



