讓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>

能夠在代碼中動態設置:android

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/1190000000403651segmentfault

相關文章
相關標籤/搜索