<style name="Theme.Timetodo" parent="@android:style/Theme.Holo.Light"><!-- translucent system bars --><itemname="android:windowTranslucentStatus">true</item><itemname="android:windowTranslucentNavigation">true</item></style>
//添加了这两个属性之后 就是是这个效果了 listview顶部会与actionbar重叠,网上都是通过layout设置padding来解决
2.设置颜色和设置padding
privatevoid 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()); }}
Github 上的 SystemBarTint:Apply background tinting to the Android system UI when using KitKat translucent modes
https://github.com/jgilfelt/SystemBarTint
http://stackoverflow.com/questions/20781014/translucent-system-bars-and-content-margin-in-kitkat