讓Android支援透明狀態列

weixin_33831673發表於2015-07-14
<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());
    }
}

 

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

相關文章