Android -------- 使手机状态栏背景颜色和activity的一致

Activity类中:

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//透明状态栏
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//透明导航栏
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}

Layout布局文件中:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:fitsSystemWindows="true"
android:clipToPadding="true"
android:background="@drawable/test_bg"
android:orientation="horizontal" >

上一篇:Codeforces Round #337 (Div. 2) A. Pasha and Stick 数学


下一篇:Hbase 计数器