0: 设置为没有actionBar的样式
首先是主题 : android:theme="@style/Theme.AppCompat.Light.NoActionBar"
//4.4版本及以上
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
首先是主题 : android:theme="@style/Theme.AppCompat.Light.NoActionBar"
<application android:name="com.wbm.app.application.MyApp" android:allowBackup="false" android:icon="@mipmap/appicon" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/Theme.AppCompat.Light.NoActionBar">
//4.4版本及以上
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
Window window = getWindow(); //4.4版本及以上 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } setContentView(R.layout.activity_login);