android - how to change Background for all activities but does not change it in ActionBar? -


i need such actionbar : correct actionbarb have write background every activity manualy in layout!

but wish have such background in <style> use every activity automaticaly :

correct background problem bg in text of actionbar

what should change can use background in <style> , not apply background every activity , dont have problems title of actionbar ? when comment@color/bg_activity` in styles.xml gets correct bar (pic 1)

i use in androidmanifest.xml :

<uses-sdk     android:maxsdkversion="22"     android:minsdkversion="13"     android:targetsdkversion="22" />  <application     android:allowbackup="true"     android:hardwareaccelerated="true"     android:icon="@drawable/ic_launcher"     android:label="@string/app_name"     android:theme="@style/theme.abnactionbarholo" > 

my /res/values/styles.xml :

<resources xmlns:android="http://schemas.android.com/apk/res/android">      <!-- base application theme. -->      <!-- // abnactionbarholo // -->     <style name="theme.abnactionbarholo" parent="@android:style/theme.holo">          <!-- customize theme here. -->         <!-- <item name="android:textcolor">@color/foreground_text</item> -->         <item name="android:textcolor">@color/actionbar_text</item>         <item name="android:background">@color/bg_activity</item>         <!--  -->         <item name="android:actionbarstyle">@style/abnactionbar</item>         <item name="android:actionbartabtextstyle">@style/abnactionbartabtext</item>         <item name="android:actionmenutextcolor">@color/actionbar_text</item>     </style>      <!-- actionbar styles -->     <style name="abnactionbar" parent="@android:style/widget.holo.actionbar">          <!-- <item name="android:titletextstyle">@style/myactionbartitletext</item> -->         <item name="android:textcolor">@color/actionbar_text</item>         <item name="android:background">@drawable/actionbar_background_2</item>          <!-- support library compatibility -->         <item name="background">@drawable/actionbar_background_2</item>     </style>      <!-- actionbar title text -->     <style name="abnactionbartitletext" parent="@android:style/textappearance.holo.widget.actionbar.title">         <item name="android:textcolor">@color/actionbar_text</item>         <item name="android:background">@drawable/actionbar_background_2</item>         <item name="android:shadowcolor">@color/actionbar_shadow_text</item>     </style>      <!-- actionbar tabs text styles -->     <style name="abnactionbartabtext" parent="@android:style/widget.holo.actionbar.tabtext">         <item name="android:textcolor">@color/actionbar_text</item>     </style>   </resources> 

/res/values-v14/styles.xml

<resources>      <!--         base application theme api 14+. theme replaces         appbasetheme both res/values/styles.xml ,         res/values-v11/styles.xml on api 14+ devices.     -->       <!-- actionbar styles -->     <style name="abnactionbar" parent="@android:style/widget.holo.actionbar">         <item name="android:titletextstyle">@style/abnactionbartitletext</item>         <item name="android:textcolor">@color/actionbar_text</item>         <item name="android:background">@drawable/actionbar_background_2</item>          <!-- support library compatibility -->         <item name="background">@drawable/actionbar_background_2</item>     </style>  </resources> 

in /res/values/colors.xml

<resources>      <!-- // abn holo // -->     <color name="actionbar_text">#ff000000</color>     <color name="actionbar_shadow_text">#ffd3d3d3</color>      <!--  -->     <color name="black_overlay">#66000000</color>     <color name="bg_activity">#ff000f2f</color>     <color name="foreground_title">#ffff8800</color>     <color name="foreground_version">#ffffa900</color>     <color name="foreground_text">#ffffffff</color>  </resources> 

instead of creating theme actionbar create layout xml file (ex actionbar.xml) of choice in layout folder , use in every activity.

example: have actionbar.xml file in layout folder

      //----------action bar----------//         actionbar actionbar = getactionbar();               textview title;                 getactionbar().setdisplayoptions(actionbar.display_show_custom);                  getactionbar().setcustomview(r.layout.actionbar);                  title= (textview)findviewbyid(r.id.title);                 title.settext("general categories");  

this best way of creating custom actionbar......


Popular posts from this blog