How do I make scrollbar semi-transparent? - android

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

Related

How to create custom style for Android SearchView?

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.

How to add a custom title bar with an image as background in android studio

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.

Android custom ProgressBar with custom progress

Is that possible to have a custom ProgressBar in Android like this:
I mean:
Not spinning (static)
Progress with one color and remaining area with another color
With text in center
If that's not possible, what's the nearest result that I can have? Maybe using XML Shapes? Thanks!
There is not a standard Android component for reaching this result.
However, there is a library that you can use to achieve that effect.
Check this library.
You can customize this component as you like and use it on your xml layouts like a Custom View.
Check this library: https://github.com/wasabeef/awesome-android-ui/blob/master/pages/Progress.md. It does what you want.

Custom Title Bar Similar to this one

I want to create a custom title bar, somewhat like this, in my Android app. Please pardon if my question seems idiotic, I'm a beginner. Can anyone tell me if it is a titlebar or an Action bar? Plus how can I give this Shaded Black color to my titlebar/action bar?
PS: I'm using GingerBread on my Android. My app will require minimum SDK version to be 4 but it targets Jelly bean too. In GingerBread, I can't make use of ActionBars. Please help me with the problem. It would be highly appreciated.
You will want to use the ActionBarSherlock library for this (which will allow you to use this all the way back to SDK version 4).
It is reasonably easy to style, and is for sure the right way to do this. Lots of examples for this, as it is a very popular library.
http://actionbarsherlock.com/
If you are wanting to target min API 4, then as you state you'll be unable to use the ActionBar.
So you could just create your bar as a LinearLayout or something with whatever buttons / icons you want on it and have it at the top of all of your Activities. If you have many of them it would probably be worth it to refactor the Bar (click handlers and such) handling into a subclass of Activity, and then extend that with all of your other activities.
The visual effect could be easily achived with a 9-patch png set as the background of a LinearLayout. Just make the gradient you want in photoshop/Gimp and drop it into draw9Patch to add the pixels on the edge that will allow it to stretch nicely to fit any screen.
Edit: using actionbar sherlock as others suggested is probably a better idea than doing it "manually" as I suggested.

android facebook-foursquare style header

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

Categories

Resources