让Android支持透明状态栏

<style name="Theme.Timetodo" parent="@android:style/Theme.Holo.Light">

    <!-- translucent system bars -->

    <item name="android:windowTranslucentStatus">true</item>

    <item name="android:windowTranslucentNavigation">true</item>

</style>

可以在代码中动态设置:

private void initSystemBar() {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

        setTranslucentStatus(true);

        SystemBarTintManager tintManager = new SystemBarTintManager(this);

        tintManager.setStatusBarTintEnabled(true);

        tintManager.setStatusBarTintResource(R.color.actionbar_bg);

        SystemBarConfig config = tintManager.getConfig();

        listViewDrawer.setPadding(0, config.getPixelInsetTop(true), 0, config.getPixelInsetBottom());

    }

}

让Android支持透明状态栏

 

参考自:http://segmentfault.com/a/1190000000403651

你可能感兴趣的:(android)