My default color is purple (#9b59b6) i want to change top title (blue) color to purple as well. I red manual on Customizing the Account Kit UI in Android Implemented style like this, but had no further luck changing top title color to purple.
//Delauft color: purple
UIManager uiManager = new SkinManager(SkinManager.Skin.CONTEMPORARY, ContextCompat.getColor(this, R.color.default_color), R.drawable.register_screen, SkinManager.Tint.WHITE, 0.1);
configurationBuilder.setUIManager(uiManager);
In my style.xml i have
<style name="AppBaseTheme" parent="android:style/Theme.Light.NoTitleBar">
<item name="colorPrimary">#9b59b6</item>
<item name="colorPrimaryDark">#9b59b6</item>
<item name="colorAccent">#9b59b6</item>
<!-- other elements-->
</style>
Other activities works fine.
I have app that look like this:
UPDATE
Solution: In AndroidManifest
<activity android:name="com.facebook.accountkit.ui.AccountKitActivity" android:theme="#style/CustomFbStyle" tools:replace="android:theme"/>
And in style.xml
<style name="CustomFbStyle" parent="Theme.AccountKit">
<item name="colorPrimary">#9b59b6</item>
<item name="colorPrimaryDark">#9b59b6</item>
</style>
Please check the theme you are using i.e Appbasetheme is the same which you have mentioned in application tag of manifest.
<application
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppbaseTheme">
or you can also use specific theme to specific class by giving android:theme tag to that class in manifest
Related
I'm trying to do something like the mockup below. I need the first item to have a different background than the others. I also need this first item to be unclickable. I tried the enabled="false" attribute but that greys out the text which I don't want. Also I have tried itemBackground in styles.xml to change the item background color but this changes all of them and I only want the first item to have a different background. And lastly, I'd like some indentation in the last two items (not sure if this is even possible as I don't see padding and margin attributes).
Add popupMenu style to ur AppTheme:
<style name="AppTheme" parent="android:Theme.Light">
<item name="android:popupMenuStyle">#style/PopupMenu</item>
</style>
<style name="PopupMenu" parent="#android:style/Widget.PopupMenu">
<item name="android:popupBackground">#android:color/white</item>
</style>
manifest.xml:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
.............
</application>
For some reason this setup just gives me the default action bar background colour.
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar"
parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#d73830</item>
</style>
</resources>
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
...
</application>
In activity_main.xml my theme is set to 'AppTheme'.
You have wrong parent of MyActionBar.
It must be from AppCompat, like next:
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background" tools:ignore="NewApi">#color/red</item>
<item name="background">#color/red</item>
</style>
What you can do is to use hash code of colour.Here is how.Go to this web page
http://www.color-hex.com
Choose a colour you wish and after copy the code of that colour and later paste into your background section.In general lets say you want your background colour of your screen to be red so you must declare it in xml layout file like this
android:background = "#FF0508"/>
You can declare this code almost everywhere where you want to change exact things colour and for my opinion its the easiest way.Why not?you got a webpage where you can get colour code and you can use it with a single line everywhere.Delicios isn't it?
I'm using ActionBarSherlock to make my app compatible with older devices. The implementation was easy, but now i need to style the default Holo blue line that you see under the tabs to a red line.
I've been reading a few topics (topic 1, topic 2) here on SO and also the ABS doc (link), but i can't get it to work.
This is what i have so far.
In my AndroidManifest.xml i added this line to the application tag.
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock" > <!-- SET THE DEFAULT THEME -->
Then in res/values/styles.xml i have:
<resources>
<style name="AppTheme" parent="android:Theme.Light" />
<style name="Theme.MyTheme" parent="Theme.Sherlock">
<item name="actionBarStyle">#style/Widget.MyTheme.ActionBar</item>
<item name="android:actionBarStyle">#style/Widget.MyTheme.ActionBar</item>
</style>
<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#ff000000</item>
<item name="background">#ff000000</item>
</style>
</resources>
But when i run my app, then i still see the default blue line color.
What am i doing wrong?
EDIT
Read this if you want to fully style your ActionBarSherlock!
I found an answer here on SO which gave the following link:
http://jgilfelt.github.com/android-actionbarstylegenerator
It's an easy generator which generates all the needed files for a fully customized ABS! All you have to do is copy the generated files into the appropiate folders and you're set!
Don't forget to enable the style (you'll have to enter a style name in the generator) in your AndroidManifest. For that, see the answer below.
A few things:
You don't really need <style name="AppTheme" parent="android:Theme.Light" /> anymore unless you want to change it to inherit Theme.Sherlock and use it for your app theme. If you decide to do this you will have to use Theme.MyTheme for activities.
Either way, to fix the problem you want to change
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock" >
to
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.MyTheme" >
OR you can apply the theme directly to your activities:
<activity
android:name="com.awesome.package.activity.SomeActivity"
android:theme="#style/Theme.MyTheme"/>
Side note, I recommend this excellent actionbar theme generator
Set in your manifest file theme as follows:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.MyTheme" >
It will preserve all Sherlock themes and will add your custom styles.
Is it possible to change the colour of background while switching between activities?
I mean the black colour what apear while one of activities disappear and before second appear. Thanks.
Just you need to head over to the activity_home.xml
At the starting lines of code add this background parameter to set the screen black
android:background="#ffffff"
you may change the theme that you are using as follows:
application android:icon="#drawable/icon" android:label="#string/app_name"
android:theme="#android:style/Theme.Light" >
Edit
as mentioned in the documentation:
<application android:theme="#style/CustomTheme">
and then tweak the theme that you like:
<style>
<color name="custom_theme_color">#b0b0ff</color>
<style name="CustomTheme" parent="android:Theme.Light">
<item name="android:windowBackground">#color/custom_theme_color</item>
<item name="android:colorBackground">#color/custom_theme_color</item>
</style>
here is the link to the topic http://developer.android.com/guide/topics/ui/themes.html#ApplyATheme
In my manifest I used to have something like this
<activity android:name=".MyActivity"
android:label="#string/app_name"
name="Theme.NoTitleBar"...
and it worked great, I mean the title bar was not shown.
But now I want to customize the theme (I want to extend the default android theme)
and I created this theme
<style name="Theme.NoTitleBar.new_skin" parent="android:Theme">
<item name="text_body_read">#style/text_body_read</item>
<item name="text_body_unread">#style/text_body_unread</item>
</style>
then in the manifest I set name="Theme.NoTitleBar.new_skin", but the title bar is still shown.
how can I hide the title bar and still have my new custom theme ?
and one more question does adding dots '.' means extending when working with styles ?
in your mainfest you should write something like:
<activity android:name=".MyActivity"
android:label="#string/app_name"
name="MyTheme"...
In your styles.xml you should write something like:
<style name="MyTheme" parent="android:Theme.NoTitleBar">
<item name="text_body_read">#style/text_body_read</item>
<item name="text_body_unread">#style/text_body_unread</item>
</style>
Dot (.) doesn't mean extending. It means referencing a certain element (listview, textview etc.) in your theme. For example, you would have:
<style name="MyTheme.Widget.ListView" parent="#android:style/Widget.ListView.White">
</style>
to define style of your listview.