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.
Related
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
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>
Hey I'm trying to change the background of my action bar but I'm not quiet sure I understand the structure of the style files. So basically I have style.xml which is to pass on some elements a desired style. Then I've Theme.xml which is to have a group of styles in it, correct ? How do you link the two in other words how do I tell the theme I want the specified style in it ? I can't manage to change the background of the action bar so here is my code:
style.xml:
<!-- Base application theme. -->
<style name="MyActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:colorBackground">#color/color_lightBlue</item>
</style>
</resources>
theme.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyCustomTheme" parent="Theme.AppCompat.Light">
</style>
</resources>
and wtf is v11/style ?
Whether you put the attributes in styles.xml or theme.xml, they have the same effect finally if you apply the theme to your app or activity. In your AndroidManifest.xml, in order to let the theme have the effect you want, you should apply your customized theme like following to your app.
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
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 used Theme.Sherlock.Light.DarkActionBar for my whole Application. Now the Action bar background color is black by default. How to change this color. Basically how to customize the Theme for whole Application?
<activity
android:name="com.mypath.myapp.FirstActivity"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock.Light.DarkActionBar"
>
You can use android:theme=theme_style in your <application> tag. Now if you want your action bar to be different than that given by the theme, then you can override it by defining the style between <style></style for your action bar specifically.
Here's the concept. Go to res > values > styles.xml. You can extend or customize your themes as follows:
<style name="AppBaseTheme" parent="android:Theme.Light">
<item name="android:background">#color/background_dark</item>
</style>
Update:
OR if you want to make generic (not theme specific) changes for all your applications, then you can edit sdk/platforms/android-target/data/res/values/styles.xml
OR if you want to override default themes for all your applications, then you can edit sdk/platforms/android-target/data/res/values/themes.xml
Update - found this:
ActionBar developer docs. This link says "You can control the behaviors and visibility of the action bar with the ActionBar APIs, which were added in Android 3.0 (API level 11)." So I assume your target is API 11 at minimum.
If you are targeting API 11 and above, you can do advanced custom styling as follows:
<resources>
<style name="CustomActivityTheme" parent="#android:style/Theme.Holo">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:background">#drawable/ab_background</item>
<item name="android:backgroundStacked">#drawable/ab_background</item>
<item name="android:backgroundSplit">#drawable/ab_split_background</item>
</style>
</resources>
Here you go , Styling Action Bar background
You can define the theme for your whole application in your manifest file in application tag as below:
<application
android:name="com.test"
android:icon="#drawable/appicon"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" > <---Define your own style here.
Have a look at http://actionbarsherlock.com/theming.html . You must create a own Theme-style.
for modifying default android sdk themes You can find android Sdk themes.xml file in :
\android-sdk\platforms\...\data\res\values\themes.Xml
so you can change your whole application theme.