I am looking to implement a 3d like ActionBar shown here. Here there is thin dark blue line below the actual ActionBar. How do i implement that?
You could achieve this using a couple of different methods.
Use a View
You could add a View that rests at the top of your layout, or just below the ActionBar then set its background accordingly.
Apply it directly to the ActionBar
Apply it via code: To apply the image via code, see ActionBar.setBackgroundDrawable
Apply it via style: If you'd like to apply it via a style, refer to the official Android guide on Styling the ActionBar
Creating the Drawable
As far as the effect you're looking for goes, I think you want something like this:
That was created using Photoshop and the 9-Patch generator in the SDK tools. You could also use the Simple Nine Patch Generator to create one.
See documentation here
https://developer.android.com/training/basics/actionbar/styling.html
Just apply the style you wish to use to the relevant part of the action bar.
Related
I have already implemented Search Interface for my app following the steps outlined in the guide below:
https://developer.android.com/guide/topics/search/search-dialog
I want to create custom styling for the SearchView as used in Google Chrome app and Google Photos app
How can we style Android SearchView embedded in Toolbar using Android Support Library?
I've already seen the following answer but that's limited to icons and text styling. I want to create custom borders and backgrounds.
https://stackoverflow.com/a/28018439/4419474
You can create a drawable XML with shape rectangle and add the tags of corner radius, solid colour to define your background shape.
Then add this drawable XML as background to the cardView. Inside this cardview add your SearchView widget.
Please let me know if you need any more help.
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.
I'm trying to add a "Share button" to my app, but I haven't found a way to manage the styling of the ActionMenu displayed to choose the app to share content to.
Currently it appears as in this screenshot:
However, I'd like to change the background color and the text color to make them reflect the ones in the ActionBar: which are the style properties that handle these two colors?
I would suggest follow this tutorial and using the linked tool:
http://blog.stylingandroid.com/styling-the-actionbar-part-3/
Jeff Gilfelt Android Action Bar Style Geberator tool
Quick mockup below, to prove it's very relevant and helpful in the direction of solving your question:
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);
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.