android - Transparent Overlay ActionBar with AppCompat? -
i have actionbar following properties:
- overlay bar, layout's parent view stretch full whole window.
- a white title color actionbar.
- transparent background.
i'm targeting api 14+, appcompat-v7:22.2.1. prepare styles this:
<style name="theme.mytheme" parent="base.theme.appcompat.light.darkactionbar"> <item name="android:actionbarstyle">@style/theme.mytheme.myactionbar</item> <item name="actionbarstyle">@style/theme.mytheme.myactionbar</item> <item name="colorprimary">#5af142</item> <item name="colorprimarydark">#06dd09</item> <item name="coloraccent">#20f304</item> </style> <style name="theme.mytheme.myactionbar" parent="@style/widget.appcompat.actionbar"> <item name="android:background">@android:color/transparent</item> <item name="background">@android:color/transparent</item> <item name="android:windowactionbaroverlay">true</item> <item name="windowactionbaroverlay">true</item> <item name="android:textcolor">@android:color/white</item> </style>
and, in manifest, set theme.mytheme
activity's theme.
1 & 2 working, 3 not. seams grey-ish background, , don't know should change/add.
try out below code, styles.xml
<resources> <style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <!--<item name="android:windowactionbaroverlay">true</item> <item name="windowactionbaroverlay">true</item>--> <item name="android:windowactionbaroverlay">true</item> <item name="android:actionbarstyle">@style/myactionbar</item> <!-- support library compatibility --> <item name="windowactionbaroverlay">true</item> <item name="actionbarstyle">@style/myactionbar</item> <item name="android:windowcontentoverlay">@null</item> </style> <!-- actionbar styles --> <style name="myactionbar" parent="@style/widget.appcompat.light.actionbar.solid.inverse"> <item name="android:background">@color/transparent</item> <item name="android:titletextstyle">@style/theme.yourtheme.styled.actionbar.titletextstyle</item> <!-- support library compatibility --> <item name="background">@color/transparent</item> <item name="titletextstyle">@style/theme.yourtheme.styled.actionbar.titletextstyle</item> </style> <style name="theme.yourtheme.styled.actionbar.titletextstyle" parent="@android:style/widget.textview"> <item name="android:textsize">13sp</item> <item name="android:textstyle">bold</item> <item name="android:textcolor">@android:color/white</item> <item name="textsize">13sp</item> <item name="textstyle">bold</item> <item name="textcolor">@android:color/white</item> </style> </resources>
Comments
Post a Comment