How to change the color of a specific acitonbar element
5 answers
You can do it from your Activity Class
In onCreate()
your method, Activity
just add these lines and do the necessary imports.
android.app.ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#d44334")));
It also works in the support action bar.
+1
source to share
<item
android:id="@+id/actionViewLayout"
android:showAsAction="always"
android:title="Title"
com.myapp.app:actionLayout="@layout/your_xml_file"
/>
It is important that you use your package name instead of "android" when using the SupportActionbar. Also don't forget to add the namespace to the XML.
0
source to share