Android 全屏方法
1 @Override 2 public void onCreate(Bundle savedInstanceState) { 3 super.onCreate(savedInstanceState); 4 //去标题 5 this.requestWindowFeature(Window.FEATURE_NO_TITLE); 6 7 //全凭 必须在setContentView之前 8 this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 9 WindowManager.LayoutParams.FLAG_FULLSCREEN); 10 11 setContentView(R.layout.logo); 12 13 }
通过主题样式
1 <?xml version="1.0" encoding="utf-8"?> 2 <resources> 3 <!-- name 是Style的名称,parent 继承那个父类样式 --> 4 <style name="theme_fullScreen" parent="android:Theme.Black"> 5 <item name="android:windowNoTitle">true</item> <!-- 设置无标题 --> 6 <item name="android:windowFullscreen">?android:windowNoTitle</item> 7 8 <!-- 是否填充满屏幕,引用android:windowNoTitle 的值 --> 9 </style> 10 </resources>