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.
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.
I'm developing my first android application using appcompat v7 and the android support library with API 23. I would like to know how can I make the scrollbar semi-transparent like Gmail for example.
This is the scrollbar I get by default on my RecyclerView
my scrollbar
and this is what I'm trying to achieve
desired scrollbar
Thank you for your help!
You need to create a custom style for your scrollbar. Use scrollbarThumbVertical for providing a custom drawable for the indicator of the scrollbar. Here is a link to a tutorial where you can learn more about styling a scrollbar.Scroll Bar Styling
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.
I'm trying to create a custom actionBar with a different shape (not rectangular) as shown on the image below, does anyone knows point me on the right direction?
At this point, it is no longer an ActionBar. Something like that would be a custom View.
It is missing a number of key components of the ActionBar such as the application icon and back arrow, and is lacking all of an ActionBar's styling.
You can create a completely custom View class and use that, or make a reusable layout and include it wherever needed using an include tag.
I want to implement a header which has gradient background and a right icon, as is facebook & foursquared android apps. I couldn't find any tutorials about this.
I looked into foursquared source code but couldn't find how they implement this. If you can show me a way to implement this in that foursquare source code, it would be helpful.
You can take a look at GreenDroid https://github.com/cyrilmottier/GreenDroid.
Just make a custom component that consist of a LinearLayout or RelativeLayout where you set the background of it to your gradient color, and then just add the desired components of the header as child views of your layout.
Then include this layout in all your activities layout at the top.
Check out the iosched app source code. They build an action bar using a style.
Here's the layout for the home activity:
http://code.google.com/p/iosched/source/browse/android/res/layout/activity_home.xml
Here's the include for the action bar:
http://code.google.com/p/iosched/source/browse/android/res/layout/actionbar.xml
Here is the style that defines the action bar:
http://code.google.com/p/iosched/source/browse/android/res/values/styles.xml