mainActivity.java中
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/**
* 全屏设置,隐藏窗口所有装饰
*/
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.FEATURE_NO_TITLE);
/**
* 标题是属于view的,隐藏窗口所有修饰对标题没有任何影响,需要去掉标题
*/
setContentView(R.layout.activity_main);
}
这样之后,要在此页面的XML配置文件中更改如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg1" ---要全屏显示的图片
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.xiao.my.MainActivity" >
</RelativeLayout>