Im using SDK 3.0 and with the xml down here I can change the tabs into Holo Dark theme. Is it possible to change fontsize, because the one I get gives me a swipeable tabBar? And can I get the color pink instead of the blue one?
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>14</tool-api-level>
<manifest>
<application android:theme="#android:style/Theme.Holo"></application>
</manifest>
</android>
Edit: I tried to follow this exampel: Android Action Bar theme But i can't get it to work. Otherwise this is exectly what I want.
You can use the ActionBar Style Generator to customize your ActionBar Theme. The tool gives you all resources you need within a "res"-folder. Just copy that folder to platform/android beneath your application's root project directory.
In your custom Manifest or directly in the tiapp.xml you refer to that theme by its name:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<application android:theme="#style/Theme.myCustomActionBarTheme" />
</manifest>
</android>
This solution works very fine for me - and I hope it helps!
I'm using the ActionBarSherlock to support an Action Bar on all platforms. It provides huge custom styling opportunities. I changed the blue separator to a green one. Here's my xml:
AndroidManifest.xml
<application android:theme="#style/Theme.GreenAB"></application>
/res/values/abs_green_style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.GreenAB" parent="Theme.Sherlock.ForceOverflow">
<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">#drawable/green_style</item>
<item name="background">#drawable/green_style</item>
</style>
</resources>
/res/drawable/green_style.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Green Bottom Line -->
<item>
<shape android:shape="rectangle">
<solid android:color="#FF177506" />
</shape>
</item>
<!-- Color of the action bar -->
<item android:bottom="2dip">
<shape android:shape="rectangle">
<solid android:color="#000000" />
</shape>
</item>
</layer-list>
If you don't need support on all platforms you might even use this without third-party libraries. Replace the parent theme (Theme.Sherlock.ForceOverflow) with an Android resource and remove the duplicate item entries in the style sections.
I wrote a blog post about how to use a custom Holo Theme in Titanium Mobile: http://blog.rafaelks.com/post/47898772164/how-to-use-custom-holo-theme-in-android-with-titanium.
It's similar to manumaticx answer.
Related
I am trying to change the underline color of Android textfields in Titanium Alloy using a custom theme, but for some reason it doesn't pick up my new colors(s).
I have created a theme under project/app/platform/android/res/values/awesome_theme.xml with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="awesome" parent="#style/Theme.AppCompat">
<item name="colorControlNormal">#ff0000</item>
<item name="colorControlActivated">#00ff00</item>
<item name="colorControlHighlight">#0000ff</item>
</style>
</resources>
And I have changed my tiapp.xml file to use the new theme:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<application android:theme="#style/awesome"/>
</android>
I have cleaned the project, but the text field is still showing up with the default blue underline when I rebuild the project.
What am I doing wrong here?
You have to use a different background image, go to your XML "awesome_theme.xml" and add the custom EditText style
<style name="EditTextCustomHolo" parent="android:Widget.EditText">
<item name="android:background">#drawable/apptheme_edit_text_holo_light</item>
<item name="android:textColor">#ffffff</item>
</style>
insted of using image drawble file--> apptheme_edit_text_holo_light in that EditText style you can use a drawable resource file which has a stroke , go with that one or this stroke one ,
<?xml version="1.0" encoding="utf-8"?>
<item>
<shape android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#color/white"/>
</shape>
</item>
then Just do this in your EditText:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="#style/EditTextCustomHolo"/>
or
you can change Underline of EditText color specifying it in awesome_theme.xml. add the following tag under your style Theme.AppCompat.
<item name="android:textColorSecondary">#color/primary_text_color</item>
Note : android:textColorSecondary is used to determine the color of the back arrow and DrawerLayout hamburger icon in the ActionBar, too soo careful
The application I'm developing has several lists of items (including one in NavigationDrawer, one in a dialog, etc).
When the user press one item on the list on pre-lollipop smartphones, the background changes to a light blue color (including preferences on PreferenceActivity). On lollipop devices, however, the background changes to a light grey color with a beautiful ripple effect. What I want is to have the same light grey color for all devices (the ripple effect is not needed).
I've seem some posts of people styling ListView items setting backgrounds, but I need an approach to style all of them at once.
ps: my app uses Theme.AppCompat.Light.NoActionBar as base theme.
Create a file res/drawable/listitem_background.xml with the following content :
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="#color/purple_dark" />
<item android:drawable="#android:color/transparent" />
</selector>
Replace the #color/purple_dark with the color of your choice.
Then, in your theme, add the following line :
<item name="android:activatedBackgroundIndicator">#drawable/listitem_background</item>
EDIT:
To mantain the lollipop effects and colors instead of placing the theme in the values folder, place it in the values-v22
Define a style resource file like this one
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="android:Theme.AppCompat.Light.NoActionBar">
<item name="android:listViewStyle">#style/MyListViewStyle</item>
</style>
<style name="MyListViewStyle" parent="android:Widget.ListView">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<!-- Other stuff you need -->
</style>
</resources>
In your manifest set
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/MyTheme">
Now all of your ListView's will look like you define in style by default. You can of course change some of them if you want.
You can find a more complex, but very useful sample HERE
I am developing an application and i set "android:textIsSelectable" for the TextViews.
But my material theme is not matching with the TextSelection appBar. Is there a way by which i can change the color of that appBar ??
Attached the Image Below Check it :-
Assuming you use the appcompat-v7 library add these to your theme:ยจ
<!-- this makes sure the action mode is painted over not above the action bar -->
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">#drawable/myapp_action_mode_background</item>
Now I wasn't able to style the insides of the action mode (text color, icon colors) so hopefully you won't need to.
Note: If you don't use the support library prepend those style item names with android:. These will work above API 11+.
EDIT
For an action mode background with a stroke create a new drawable and update the reference. The drawable could look like this:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="-2dp" android:left="-2dp" android:right="-2dp">
<shape android:shape="rectangle">
<solid android:color="#color/primary_dark"/>
<stroke android:color="#color/accent" android:width="2dp"/>
</shape>
</item>
</layer-list>
In your resources styles.xml: "android:textColorHighlight"
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textColorHighlight">#color/yellow</item>
</style>
</resources>
You can put in whatever color you choose and whatever parent theme you are using.
I searched a lot but could not find.
I want the basic gray color of SeekBar change to white.
All the examples I've found it just change the color of progress.
Can anyone help me?
Try creating progress.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#android:id/background"
android:drawable="#drawable/background_fill" />
<item android:id="#android:id/progress">
<clip android:drawable="#drawable/progress_fill" />
</item>
Then in your seekbar declaration in xml set:
android:progressDrawable="#drawable/progress"
You can refer below link for creating Android components such as editext or spinner or seekbar with your own colors for your Android application. It will generate all necessary nine patch assets plus associated XML drawables and styles which you can copy straight into your project.
For ex. for your case you can go to this link and download the zip file for your new seekbar with custom color.
http://android-holo-colors.com
Here you go:
<androidx.appcompat.widget.AppCompatSeekBar
android:progressBackgroundTint="#color/gray"
android:progressTint="#color/white"
Ok, So, there are two things
You want to change Seekbar style through out the app
You want to change Seekbar style for specific screen
If want to change through out the app. Add this in your style.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="seekBarStyle">#style/AppSeekBar</item>
</style>
<style name"AppSeekBar" parent="Widget.AppCompat.SeekBar">
<item name="android:thumb">#drawable/ic_launcher</item>
<item name="android:background">#drawable/app_seekbar_background</item>
</style>
</resources>
And that's it, all SeekBar in the app will start using this style.
If you want to change for specific screen. Add this in your style.xml
<resources>
<!-- your rest of code -->
<style name"AppSeekBar" parent="Widget.AppCompat.SeekBar">
<item name="android:thumb">#drawable/ic_launcher</item>
<item name="android:background">#drawable/app_seekbar_background</item>
</style>
</resources>
And in the your_layout.xml file add this
<!-- your rest of code for layout -->
<SeekBar
android:layout_width="100dp"
android:layout_height="40dp"
style="#style/AppSeekBar"
<!-- your rest of code for seek bar-->
/>
This should reflect your style.
And if you want to change anything else for you can come to this style.xml file and change, no need to change each and places you are using SeekBar
How do i remove this line under the action bar?
(source: android.com)
I would like it to be a solid color like the way google+ or the below app is:
i have tried
<item name="windowContentOverlay">#null</item>
<item name="android:windowContentOverlay">#null</item>
But that doesnt seem to remove it. All i want to do is just use a solid color, no tiled image, no gradient.
they this code it is override Background of actiobar
ActionBar actionBar = getSupportActionBar();
actionBar.setBackgroundDrawable(getResources().getDrawable(
R.drawable.actionbar));
drawable/actionbar.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="#06B697" />
</shape>
You can change the style the ActionBar using the styles.xml file in res/values
In the theme you are yusing for your app write
<item name="android:actionBarStyle>#style/actionBarStyle</item>
and add the style actionBarStyle
<style name="actionBarStyle"
parent="#android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:background>Color or drawable you want as background</item>
</style>
Here is a nice tutorial about this
alternativly, you can style the actionbar programmatically from an activity:
getActonBar.setBackgroundDrawable(drawable you want as background);