I want to change title color background(green) to full width.
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert"> <item name="colorAccent">#000000</item> <item name="android:textColorPrimary">#5c5c5c</item> <item name="android:background">#fbdd9d</item> <item name="android:windowTitleStyle">@style/TitleDialogTextStyle</item> </style> <style name="TitleDialogTextStyle" parent="Base.DialogWindowTitle.AppCompat"> <item name="android:textColor">#ffffff</item> <item name="android:background">@color/green</item> </style>
Please find attached snap. I want green color to full width.
I made a lot of tries, I never succeded to change the color defining a custom android:windowTitleStyle
or a android:windowTitleBackgroundStyle
. It only works using the following trick, add to your custom dialog style :
<item name="android:topDark">@color/your_color</item>
And the title background will be colored as you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.