Reputation: 302
I'm trying to animate a dialog open from view position. I want that my dialog shows from a button position for example and hides to the same position when dismissed.
this thread Animate a custom Dialog gave me an idea and i came to this xml:
<scale
android:duration="500"
android:fromXScale="0.0"
android:fromYScale="0.0"
android:pivotX="20%p"
android:pivotY="20%p"
android:toXScale="1.0"
android:toYScale="1.0" />
but i dont know how to dynamically set an start position, cause my button change position.
any idea?
tks a lot....
Upvotes: 2
Views: 2522
Reputation: 1857
You can use the method getLocationOnScreen() from the View class to get the current position from the button or any other view you want to use as an anchor.
Edit - Or you may find useful to use instead of Dialog a PopupWindow using the coordinates that you can get through getLocationOnScreen in method showAtLocation().
Upvotes: 3