现在的位置: 首页 > 综合 > 正文

Android中两种设置全屏的方法

2018年02月10日 ⁄ 综合 ⁄ 共 751字 ⁄ 字号 评论关闭

第一种方法:

在onCreate(){

       .................

       ..................

        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        // remove notification bar
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

     setContentView(R.layout.main);

}

第二种方法:

在AndroidManifest.xml文件中添加android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

        <activity android:name=".test"

           
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

抱歉!评论已关闭.