onclick does not work during translate animation android - android

This is not a new problem. But a bit different.
There are lots of questions and answers in SOF on click not working after translate animation. I have gone through them all. But my issue is a bit different.
I am trying to move an object in the screen from button to top in the y axis. Again this is a repeat animation. So basically my button goes to the top and when reaches there, it starts from bottom again. This is quite easy with Translate animation with the help of repeatcount and repeat mode method.
Now the real problem is the click on that button does not work. And I know the reason also. What i am looking for is a solution to my requirement.
I dont think I can use Translate animation. Help me guys

I got a way to do this. I am using a handler to set the object topmargin by some value to move it up.

Related

Android efect animation on click

I've been searching for an easy way to make a cube effect animation when a button is pressed but my search yielded nothing. The idea is that when a button is pressed the text of the button changes after a cube animation is displayed. Does anyone know how something like that can be achieved? Is there maybe a function that helps me do that? Keep in mind I am still a beginner so I am looking for an easy way to it. Thanks for your help.
Android API has "animators" which are responsible for animation of either object properties or values. I'm a bit unsure if this cube you're trying to animate is a shape or just an image view but I am assuming it is an image view. Therefore, this url should help.
https://developer.android.com/reference/android/animation/ObjectAnimator.html

Reticle not detecting button

I have 4 buttons (called 'paintings' here) and I need the gvr reticle to be able to click on each. The funny thing is, the reticle works on three of the buttons, just not the 'south' one.
My FirstPersonCharacter has a Main Camera with the GvrReticle.
Things I've tried:
deleting my existing south button and replacing it with a duplicate of one of the working buttons
disabling the other 3 buttons
moving the canvas and button off the wall
All of the painting-buttons come from the same prefab and I didn't make any changes to the south one, so I don't think the problem is with the painting-button itself.
Let me know if there's more information I can provide to help pinpoint the issue!
I had to set PaintingSouth's rotation to 180. When I looked carefully at the four paintings, I could tell PaintingSouth's text was backwards. I guess if your button is facing the wrong way on a canvas, the reticle doesn't detect it?
Anyway, I hope this helps someone. I shall not forget this day.

An elegant way to keep integrity of RelativeLayout when animating it?

Ok, so...
I know, there's been a real amount of questions about it, but it either didn't work, or was really fixed in a hard way. Oh, and that's my second day trying to do it, so please, accept my apologies about that and help me for Chet Haase's sake.
I have a button on top of a fragment, and a RecyclerView below it. When i press the button i want it to disappear and a new RelativeLayout with textfields to slide from the top.
I don't want to make it with animateLayoutChanges="true", cause it's not exactly what i was meant to do, and i want rather learn, than do it.
I tried to do it with widget.animate().translation... and the result was that one widget was just thrown in it's place when the rest of layout stood still. That's not what i meant to do.
I tried also to make an "new TranslateAnimation" since it has this "setFillAfter/Before" attribute... but that did not help me neither.
What i tried as well was to update the layout somehow adding to id margins and stuff (don't remember anymore, and i'm in work right now trying to figure it out, sorry) as it was described in some questions.
But none of that worked. I don't include code right now, cause i already tried to do it in some dozens of different ways.
Could you please tell me how to move a widget and make the rest of them to move with it? Is it possible?
I've already got it going once using setVisibility,animateLayoutChanges and animation combination, but that was massive and dirty as a baby duck.
Edit: oh, i almost forgot about it. Another problem is that when i animate/move a widget, only the rendering spod changes, but the real spot of it stays the same (ex. a onclicklistener)
Ok, me again.
I did it this way, that - let's say - i want to slide a button up and remove it.
So i animate it and all the other widgets (right, i can make a ViewGroup) up, put a listener on animation, and on "onAnimationEnd" i clear all the animations and set the visibility to GONE.
The animateLayoutChanges must be set to false
Still it's not what i wanted, so i'd be indebted to anyone who shows me another, better way.

How to get iphone like animation for button in android

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

Android - Textview or Drawable generated and animated programmatically

First off, I'm a beginner. If this is way beyond the scope of a beginner's first application, just tell me.
The best way to explain what I want is as an example: In Robo Defense, when you kill something, a little $10 pops up, animate translates/fades up about 5% of the screen and disappears. (almost like a toast, appears on top of canvas)
I'm looking for something similar to that same effect. As a like, top-layer drawable that ignores the underlying defined XML layout. I can handle the animation part of the code, but I'm curious as to how to create and inflate that view without wreaking chaos on my current layout. If it would be easier as a drawable instead of text, thats really not a big problem for my project. It is simply imformative, no interactivity at all, it will just be a quick little 500ms artifact to show that an action has occurred.
I could use a pointer in the right direction, or some similar code examples please.
I think you would create the TextView within your Java code, and then use an animation to make it rise and fade, once the animation has finished, destroy the TextView.
I've never done this before, but I think that should work!
To anyone else who is wondering, I ended up accomplishing this via wrapping my entire layout in RelativeLayout, making the appropriate changes necessary, then creating a TextView programmatically with layout_above, and then calling an Animation on it.

Categories

Resources