Android 设置Activity 全屏的方法

来源:互联网 发布:淘宝旧版本4.0.0下载 编辑:程序博客网 时间:2024/05/01 15:31

1、代码实现

public void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);//==============注意要在加载setContentView(R.layout.main)之前设置,不然程序崩溃=============== //无title               requestWindowFeature(Window.FEATURE_NO_TITLE);   //全屏getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN ,                          WindowManager.LayoutParams. FLAG_FULLSCREEN);  //==============注意要在加载setContentView(R.layout.main)之前设置,不然程序崩溃===============setContentView(R.layout.main);}


2、在AndroidManifest.xml的Activity 属性中设置

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

<activity android:name="com.dapai178.chesshall.ExpandableListViewTest"              android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >        </activity>






0 0