在Android的全屏活动?全屏、Android

2023-09-12 00:04:46 作者:. 帅不帅

如何制作一个活动全屏幕?我的意思是没有通知栏。任何想法?

How do I make an activity full screen? I mean without the notification bar. Any ideas?

推荐答案

您可以做到这一点编程方式:

You can do it programatically:

public class ActivityName extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // remove title
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
    }
}

或者,你可以通过你的的Andr​​oidManifest.xml 文件做到这一点:

<activity android:name=".ActivityName"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>