Android自定義標題欄
阿新 • • 發佈:2018-12-15
補充:
這位大佬的方法設定完成後是白色的背景,如果需要自定義背景可以在style中新增:
<style name="CustomWindowTitleBackground"> <item name="android:background">#000000</item> </style> <style name="CustomTheme" parent="@android:style/Theme.Holo.Light"> <item name="android:windowTitleSize">100dip</item> <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item> <item name="android:windowActionBar" tools:ignore="NewApi">false</item> </style>
如果需要將狀態列與標題欄設定相同顏色,可以在Activity的onCreate的方法中加入:
getWindow().setStatusBarColor(0xff000000);