I am using actionbarsherlock for the tab view and I want to change the background image of the tab.Is there any way to do this?
I don't know if it is possible to set a drawable as background for the actionbar tabs.
But is is certainly possible to change the actionbar colors. You can use the Android Action Bar Style Generator to generate a style that contains all the colors you like.
The generator should create a zip with all the needed style and drawable files for your actionbar. You know can reference this styles in application theme or the themes for the activities that should use the style.
have you tried,
getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.menu_head));
For more details, refer to this post
and this post
Edit-
Check this link, if it helps.
Yes, use setIcon():
tab1.setIcon(R.drawable.tab_home_unselect);
Related
I have found several answers on here as to how to change the background color and add a custom icon to the title bar in android studio but am having difficulties finding an answer for how to use a custom image as the background instead of just a color in the title bar. Any help would be much appreciated. Thanks.
sadly you cannot add images as the background on both the header and textView/webView that's why you don't see any apps on android with image backgrounds. you could try using html instead of xml, like:
replace colors.xml, styles.xml, ect with colors.html, styles.html, ect
but i doubt that will work. hopefully they will add this feature later in the android sdk.
Is there a way to replicate the color changing ability provided by QKSMS .
It allows a user to select a color and then changes the app color and everything to that color.This is all done dynamically the moment the user chooses a specific color.
You can try this cool online tool: http://android-holo-colors.com
This enables you to create many themes for app widgets with your preferred color. You can then change your app theme by saving values for your theme in SharesPreferences or something similar and apply them in onCreate of each activity you have in your app. You can also create the themes easily in styles.xml. For each view, it has its own style with its own attributes so you will need to learn how to edit the theme of each view you want by searching...
Hope that helps.
Some Examples:
ActionBar:
https://developer.android.com/training/basics/actionbar/styling.html
Buttons:
https://www.androidcookbook.com/Recipe.seam?recipeId=3307
SeekBar:
Android - styling seek bar
Switch:
How can I style an Android Switch?
And a lot more... You will have to search for what you want.
I'm aware of using styles and themes for adjusting my Actionbar and tabs, but what I haven't been able to discover is a way to have a single image as a background for both of them, as opposed to one image being used once in the Actionbar and once again for every tab. I want them all to share a static background.
Here is a rough mockup of what I'm envisioning. Can this be done without having to resort to a faux Actionbar and tabs? Additionally, could I bleed into the status bar?
For the actionBar color, I suggest you use the Android asset studio here. It's a easy way to change the actionBar color and style. All you need to do is generate the style you want, download zip file, unzip it, copy all files (drawable folders) into your res folder and change your app theme in the AndroidManifest.xml to what you just generated from asset studio.
Am new to this tech.
I am trying to build an application,in that i want to Remove default Title bar,and want to add my customised title bar.
Thanks in advance
It's called ActionBar in android. To remove it completely, you have to use a theme which doesn't contain ActionBar like Theme.NoTitleBar or Theme.AppCompat.NoActionBar if you're using AppCompat support library.
You need a custom ActionBar to achieve this.
Please consider reading this training and also this tutorial
I would like to customize Holo theme by changing the default blue color to fit my company color.
Is there an easy way to do this?
Or I have to redefine the style of all components with blue parts, such as dialog titles, actionbar bottom line, pushed buttons, pickers, etc.
I cannot add anything more than this link:
http://android-holo-colors.com/
Android Holo Colors Generator
The Android Holo Colors Generator allows you to easily create Android
components such as editext or spinner with your own colours 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. If you have any question, please refer to the FAQ
or report an issue.
;-)
As an addition to Waza Be's answer, you might want to use this for styling the Action Bar:
The Android Action Bar Style Generator allows you to easily create a simple, attractive and seamless custom action bar style 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.
This blog has an excellent tutorial on how to use it properly.