I have been searching the net and so far either no solution or a very lengthy process.
All I want to be able to do is change the colour of my action bar and the menu that pops down to red.
I do not want to change anything else.
I would really appreciate if someone could tell me a way to do it, if there is one.
Thanks
Yes, You can but, you have to modify your resources, try the following link:
http://jgilfelt.github.io/android-actionbarstylegenerator/
The above link is used to edit actionbar colors and menu colors. Just you have to pick the colors and styles. after choosing just download the files and place in your project. I hope it will help you.
Yes its possible.. See this page will help you..
https://developer.android.com/training/basics/actionbar/styling.html
This can be done in you application theme.
This is what I had pre lollipop.
in styles.xml
<resources>
<color name="WhiteColor">#FFFFFF</color>
<color name="DarkBlueColor">#0085C3</color>
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/ActionBarStyle</item>
</style>
<style name="ActionBarStyle" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:background">#color/DarkBlueColor</item>
<item name="android:titleTextStyle">#style/ActionBarTitleStyle</item>
<item name="android:icon">#drawable/ic_action_nav_icon</item>
</style>
<style name="ActionBarTitleStyle" parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/WhiteColor</item>
</style>
</resources>
in your manifest.xml make sure your app uses your personal theme
<application
...
android:theme="#style/AppTheme" >
...
</application>
Related
I worked myself thru the AndroidFundamtentals Tutorial 09.2 (App Settings) but I couldn't find a working solution for my problem.
I want to change the style (backgroundcolor) of the Settings-Fragment in my app.
That's what I have coded in the styles.xml so far:
<style name="AppThemeWithActionBar" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">#color/cr_blue_dark2</item>
<item name="colorPrimaryDark">#color/cr_blue_dark</item>
<item name="colorAccent">#color/cr_green</item>
<!-- more styles-->
<item name="preferenceTheme">#style/AppTheme.SettingsScreen</item>
</style>
<style name="AppTheme.SettingsScreen" parent="PreferenceThemeOverlay">
<item name="backgroundColor">#color/cr_black</item>
<item name="background">#color/cr_black</item> <!--one of these should make the background black-->
</style>
This code does not change the background color of the Settings fragment.
If you need more code just write an comment. :)
I just found the solution / mistake.
The parent of the style AppThemeWithActionBar is wrong.
It changes the background to light.
Change the title of the style like this:
<style name="AppThemeWithActionBar" parent="Theme.MaterialComponents">
Also change the theme of the activity in the Manifest.xml file.
I expended days looking for any documentation and really don't figured out not even how to start.
What I am looking for is the namespaces, i want to custom somethings on android, so I read that i can override the Material style, but how can I override it if i can't find the namespaces and what they do?
take a look here:
i Created my Style:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="VogoSocialTheme" parent="android:Theme.Material.Light">
<item name="android:colorPrimary">#color/primary</item>
<item name="android:colorPrimaryDark">#color/primary_dark</item>
<item name="android:colorAccent">#color/accent</item>
<item name="android:editTextBackground">#drawable/apptheme_edit_text_holo_light</item>
<item name="android:alertDialogTheme">#style/VogoSocialTheme.AlertDialog</item>
</style>
<style name="VogoSocialTheme.AlertDialog" parent="android:Theme.Material.Light.Dialog">
<item name="android:colorAccent">#122f54</item>
</style>
<!-- Colors -->
<color name="primary">#2764B5</color>
<color name="primary_dark">#B2f91816</color>
<color name="accent">#122f54</color>
</resources>
everything here I just I copied and pasted, but now i want to for example change the background color, size of text, or whatever, so probably I need to change the
<style name="VogoSocialTheme.AlertDialog" parent="android:Theme.Material.Light.Dialog">
<item name="android:colorAccent">#122f54</item>
</style>
and add a new items with specific name android:...
where can i find theses names and docs to go ahead ?
R.style reference
The R.style reference, however, is not well documented and does not thoroughly describe the styles, so viewing the actual source code for these styles and themes will give you a better understanding of what style properties each one provides. For a better reference to the Android styles and themes, see the following source code:
Source styles.xml
Source themes.xml
Ref: Using Platform Styles and Themes
i am trying to change the style of the action bar in android.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="GoetheTheme" parent="Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/GoetheActionBar</item>
</style>
<style name="GoetheActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/base_color_dark</item>
</style>
So yeah, thats what I got. Now I have put the application theme in the android manifest to the created one (GoetheTheme). But the ActionBar does not change. If I set it to #GoetheActionBar, it does. Why does GoetheTheme style don't take the GoetheActionBar style?
Can please someone explain me the style system? I really dont get it.
Thanks in advance
Sorry, my very bad. I found out, I have to use a different parameter as parent ^^
I took a Light theme based one not android specific.
Correct:
<style name="GoetheActionBar"parent="#android:style/Theme.WithActionBar">
<item name="colorPrimary">#color/base_color_dark</item>
</style>
<style name="GoetheTheme" parent="Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/GoetheActionBar</item>
</style>
I have the following styles.xml:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Main theme colors -->
<item name="android:colorPrimary">#color/primary</item>
<item name="android:colorPrimaryDark">#color/primary_dark</item>
<item name="android:colorAccent">#color/accent</item>
</style>
</resources>
Where primary is defined as:
<color name="primary">#9c27b0</color>
However in the preview the actionbar is still black and not deep purple.
When i open the theme editor the actionbar is also deep purple.
Is this a bug in the preview? Or have i done something wrong?
In general how exactly do i use the styles.xml? Can i also define button's in it?
After editing the color code in the color.xml file, you should rebuild it. Try rewriting the code and then rebuilding. I faced the same problem, that's ho
Hello I'm making a custom theme for my app. I want to have a custom ActionBar and background for the rest of the app (below the ActionBar). I'm wondering how to do the background. Right now I have:
<style name="MyTheme" parent="android:Theme.Holo">
<item name="android:actionBarStyle">#style/dActionBar</item>
</style>
<style name="dActionBar" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:background">#4C721D</item>
<item name="android:textColor">#FFFFFF</item>
</style>
Would I just have to do <item name-"android:background"></item> in MyTheme or would I have to create another style? After I create this do I need to put it in the res/styles folder? Also what are the API restrictions on this, if any?
Don't forget to apply your theme to your application in your AndroidManifest.xml.
<application android:theme="#style/CustomActivityTheme" ... />
You can find all the information about styling the Actionbar here.
To style your ActionBar with a nice Holo-look, try this website
Hope this helps!
Try to use below code in your Style.xml file
<resources>
<style name="Theme.Sample" parent="Theme.AppCompat">
<item name="android:colorBackground">#color/primary_material_dark</item>
<item name="actionBarTheme">#color/colorGray</item>
</style>
</resources>
Just need to use android:colorBackground as a name of item to define the background color like as below:
<item name="android:colorBackground">#color/primary_material_dark</item>
Hope you get your answer,Thanks.