I want to make my layout white with animation. It got a drawable background. I want to make with some duration smooth animation which makes the background white.
Is it possible? How to make it? Thanks!
Fade-in-Fade-out
The animation that you are asking is Fade-in-Fade-out, which fade out the Drawable background and fade in the white background.
You need to create XML animation. This answer is too broad suggested to see the AndroidHive tutorial about this.
Related
Now I have this task where I should create a rating bar just like youtube in my app , and so my idea was to have a textview where I set its background to a color but then remove the color according to an equation I will make so it displays only a percentage of it... any idea how can I do this or where to look ?
The simplest way to do this would be to create a selector.xml. You would assign android:background="#drawable/selector". Your selector would decide which background color to show based on what percentage you have assigned.
This link explains how to use selectors with buttons. It should help to get you on the right track...http://developer.android.com/guide/topics/resources/color-list-resource.html
EDIT: You can still accomplish a custom progress bar by xml. It is very similar to the selector. Just think of it as many more selectors based on progress instead of state. Here is a nice example...Custom Drawable for ProgressBar/ProgressDialog
You can also look into xml animations. They are similar.
I'm trying to use a listview in my application with a gradient from the bottom.
I do not want to use the gradient in the background, I like to use it in the listview.
To try to explain better, I attached a picture of what I want.
The background will show images that will change.
I searched a lot and made several tests, but without success.
I appreciate any help.
Thanks and regards
Android has something built in for that. It is called fading edge. The two XML properties are android:fadingEdgeLength and android:requiresFadingEdge. If you were hoping to have the image gradient change, I don't think they are dynamic.
In android is there anything thing like we can create a hidden button or image and it is still clickable.or alternately is there any way to achieve this functionality in Android.
In ios we have the benefit of placing a clickable hidden button.
Everything can be achieved in Android
<Button...
android:background="#null">
You can make the button transparent or translucent by using the background property:
android:background="#ARGB"
where A is the transparency, which can be set between 0-F i.e., 0 means transparent and F means opaque.
The remaining colours are R-Red, G-Green, B-Blue.
so an eg. might be:
android:background="#200B"
which gives a tinge of blue colour.
This way you can provide transparency as well as a tinge of transparent colour to your view.
This works with any view.
Also you can apply this through code:
button.setBackgroundColour(0x220000BB);
Probably use a transparent Image to the button.
I have an application which have multiple backgrounds. I would like to cross-fade these backgrounds at a fixed time interval having one background fading out while slowly showing another (kind of like a slideshow). I know how to use the cross-fading effect in xml but the problem is it won't show another image until the active image is totally fading out. I want the transitions to overlap. Please help.
Thanks.
Have a look at this tutorial: http://www.pushing-pixels.org/2011/03/07/android-bits-and-pieces-image-cross-fading.html
see the below link,which solved my problem(cross-fade effect when changing backgrounds of a view):
Crossfading using TransitionDrawable not working on android
I used style="?android:attr/progressBarStyleLarge" to create the spinning ProgressBar.
Not sure why in different layout XML it behaves differently(I am using the same device).
It shows as a blue spinning circle and a circle of gray dots. I want to use the blue spinning circle in all my pages..
please advise!
Sorry that I don't have the reputation to upload pictures.
I think its dependent on background color of the layout. once put all layouts background color to black or some unique color. Then it will look uniquely.
If you want to put as unique for all pages the solution is:
Maintain same background color for all views
Otherwise use custom progress bar.