I saw one iphone application if the button is visible and we press cancel button then that button should gone. in that case there is animation "the button diposes from left to right and finally got vanished". In android i am able to rotate any view or move it from left to right. But how can i get the effect that the button destroy animation and make a button visible in that type of animation.
Thanks
Deepak
I'm not sure that I fully understand what you're trying to do, but it seems like you want to fade the button as well as translating it. If that's the case, then you can use alpha animations to change the opacity of the button. By gradually reducing the alpha to 0, the button will appear to fade away.
I have recently completed a series on animations on my blog. It is probably best to read the articles in order starting with the first, but the final article covers animating individual widgets.
To get a general idea of animations in android, check out this awesome page on quick actions. There is plenty of code and working animations with different options so you can get a full tutorial of how they work.
How to create quick action dialog
Related
So this is the main activity of my app:
As u can see, there are 6 buttons.
I thought about the idea of setting the animation of them to be like when a bubble pops up...i mean whenever the main activity shows up i want the button to "bubble up"+ i don't want them to bubble up all together, i want a Interval of approximately half a second between each button.
Another animation i would like to add is the rounding animation, in which, whenever i press a button, it firstly spinning and then i do some actions...
Hopefully guys you understand my willings, i would be glad for any help :)
u can see android api demo where some example given for button animation
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0CCgQFjAB&url=https%3A%2F%2Fgithub.com%2Fgoogledrive%2Fandroid-demos&ei=OL70VKn6PJSpuwTsvoLQDw&usg=AFQjCNEkkqFYd6xmuOzqdv-eXhKitC_o-w&sig2=fUuJK2OQpgLIF6qZCWOY5g&bvm=bv.87269000,d.c2E
I'm supposed to make a simple android application, in fact it's almost as simple as a slideshow.
The good thing is that the content of each slide is very similar - some text and a photo. So I only have to do one layout and simply switch it's content on a slide motion or a button press.
I think it would be more appealing if I add some suitable animation - e.g. flipping the whole page.
Is there already a tool for this? If there's not than what's the best/simplest way to do this?
http://code.google.com/p/android-page-curl/
I'm new on game dev for Android.
I have a game where I need to click on moving Buttons or TextViews(not important).
I extended FrameLayout class and added some Buttons(through addView method). Then I tried to use TranslateAnimation, but it seems it doesn't updates coordinates for click event (i.e. when I click on the moving button on new position, the event is not handling, but when I click on the origin place(where it has started moving), the event catches even if the button left this place).
Question: How to create a moveable label(or button) that handles click events? Do I need to use tricks like hit testing? Or, may be I use completely wrong approach for games(e.g. I need to draw text instead of adding the views in layout)? I will be happy if you can suggest another solution.
This is limitation of the Animation in Android. They fixed that in Android 3.0. Read here for more information http://android-developers.blogspot.com/2011/02/animation-in-honeycomb.html
An excerpt:
"Finally, the previous animations changed the visual appearance of the target objects... but they didn't actually change the objects themselves. You may have run into this problem. Let's say you want to move a Button from one side of the screen to the other. You can use a TranslateAnimation to do so, and the button will happily glide along to the other side of the screen. And when the animation is done, it will gladly snap back into its original location. So you find the setFillAfter(true) method on Animation and try it again. This time the button stays in place at the location to which it was animated. And you can verify that by clicking on it - Hey! How come the button isn't clicking? The problem is that the animation changes where the button is drawn, but not where the button physically exists within the container. If you want to click on the button, you'll have to click the location that it used to live in. Or, as a more effective solution (and one just a tad more useful to your users), you'll have to write your code to actually change the location of the button in the layout when the animation finishes."
following link has some button at the top like :: "DISEASES" , "FOOD & NUTRITION" , "PHYSICAL ACTIVITY"
http://www.bam.gov/sub_yourbody/yourbody_smilestyle.html
when you focus it it will grow and remove from it it will small
so question is how can i do it?
What you have to do is set selector for your button as shown in my previous answer.
And depending on your requirement set drawable larger than the normal ones for that particular state , that will create the same effect
You have to understand that there's a huge difference between a mouse as a pointing device and your finger. A mouse can easily hover across these buttons to give you the effect, but it doesn't work as well with a finger, as you'd need to slide your finger across the buttons to get the effect - and who slides their finger across buttons instead of just pressing them?
Anyway, I suppose you could create an OnTouchListener for your Buttons, and perhaps throw in some animations to get the effects.
But - like I said - I don't see a reason to do this. It seems utterly unnecessary.
I am trying to make an application for android that is based on IPAD app. I want to keep the same look to the app, but I am not a very good designer. So I was wondering if it was possible to for me to crop say the entire header and then have an invisible button or something on top of portions of it. so the design would become a little bit easier. Also if that is possible how would I get the what ever the event item is going to be to overlap with a portion of the image if it has stranger orientation. (I think I could fake this by just moving it closest orientation and extending the size untill it fits, but it would be nice to find a better way.)
How would I go about that?
I tried making the button invisible, but that did not seem to work.
Thanks in advance
I got lost on your description. But if you want to make a button invisible, calling setVisibility(View.INVISIBLE); will not work, because it will not receive click events. You may want to set its color to transparent instead. try using:
button.setBackgroundColor(Color.TRANSPARENT);