[android-developers] Button animation

2012-03-13 Thread Tytanit
I need help - i am new to android, and i couldn't solve my problem at
my own, so i'm posting here -
I've got an image animation,  a few buttons, and an animation files
( xml) written. What i want to do, is to make a button animation ( i
don't know to bound a button with an animation) , following image
animation with a little delay - what functions should i use? What
should the code look like?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button animation

2012-03-13 Thread Marcin Orlowski
On 12 March 2012 16:47, Tytanit tyta...@gmail.com wrote:

 I need help - i am new to android, and i couldn't solve my problem at
 my own, so i'm posting here -
 I've got an image animation,  a few buttons, and an animation files
 ( xml) written. What i want to do, is to make a button animation ( i
 don't know to bound a button with an animation) , following image
 animation with a little delay - what functions should i use? What
 should the code look like?


View button = (View)findViewById( R.id.my_button );
button.startAnimation( AnimationUtils.loadAnimation(
R.anim.anim_for_my_button ) );

you can safely stick to View instead of i.e. ImageButton in case of
applying animation.

Regards,
Marcin Orlowski

*Tray Agenda http://bit.ly/trayagenda* - keep you daily schedule handy...
*Date In Tray* http://bit.ly/dateintraypro - current date at glance...
WebnetMobile on *Facebook http://webnetmobile.com/fb/*,
*Google+*http://bit.ly/webnetmobile-gpand
*Twitter http://webnetmobile.com/twitter/*

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Button Animation

2011-10-14 Thread F4L|{0
hi
I have a problem with an animation of a button.
I would move and fade a button from a origin position to another
position. well i created a translate animation and fade animation, i
start the animation with the follow code:

AnimationSet exchangeAnimation = new AnimationSet(true);
exchangeAnimation.setFillAfter(true);
exchangeAnimation.setAnimationListener(new AnimationListener() {
  public void onAnimationStart(Animation anim)
{button.setEnabled(false);}
  public void onAnimationRepeat(Animation anim) {}
  public void onAnimationEnd(Animation anim) {
  button.setEnabled(true);}});
exchangeAnimation.addAnimation(AnimationHelper.fadeAnimation(0,
1, 2000));
//i valori passati come fromX, toX, fromY e toY sono dati da un
rapporto e vanno da 0.0F a 1.0F
//quindi bisogna calcolari come pos voluta / width screen o
height screen

exchangeAnimation.addAnimation(AnimationHelper.translateAnimation(0.0F,
0.5F, 0.0F, 0.5F, 1500));
button.startAnimation(exchangeAnimation);

So, my problem is that while the button moves to the position that I
want, the hit area remains at the point of origin.

somebody can help me on how to correctly position the hit area of the
button?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Button Animation

2011-10-14 Thread TreKing
On Fri, Oct 14, 2011 at 2:49 AM, F4L|{0 simone.dolcio...@gmail.com wrote:

 somebody can help me on how to correctly position the hit area of
 the button?


AFAIK, animations only make it look like an object is moving / scaling /
whatever. The actual position / size / whatever of the View in unchanged. If
you want the position to update, manually update it when the animation is
finished.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] button animation problem

2009-02-16 Thread Christian Wiesbauer

I changed it this way:

button.setLayoutParams(new AbsoluteLayout.LayoutParams(width, height, x,
y));

-Ursprüngliche Nachricht-
Von: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] Im Auftrag von Romain Guy
Gesendet: Montag, 16. Februar 2009 20:42
An: android-developers@googlegroups.com
Betreff: [android-developers] Re: button animation problem


How do you change the layout params?

On Mon, Feb 16, 2009 at 7:37 AM, Christian Wiesbauer
christian.wiesba...@bdc.at wrote:
 Hi,



 I rotate a button 90 degrees anti-clockwise with a RotateAnimation. I also
 change the position of this button with AbsoluteLayout.LayoutParams. My
 problem is that after these steps the button cannot be clicked or focused.
 If I click on the old position (before the animation) the onClick event is
 called. How can I set the click area to the new position? Does
 TouchDelegate do the trick?



 Thanks,



 Christian Wiesbauer



 




-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] button animation problem

2009-02-16 Thread Christian Wiesbauer

I tried requestLayout() but it still doesn't work.

Maybe I use the wrong order?

1. button.setAnimation(...);
2. button.requestLayout();
3. button.setLayoutParams(new AbsoluteLayout.LayoutParams(width, height, x,
y));

Do I have to call button.postInvalidate() also?

-Ursprüngliche Nachricht-
Von: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] Im Auftrag von Romain Guy
Gesendet: Dienstag, 17. Februar 2009 08:01
An: android-developers@googlegroups.com
Betreff: [android-developers] Re: button animation problem


You should also call requestLayout().

On Mon, Feb 16, 2009 at 10:56 PM, Christian Wiesbauer
christian.wiesba...@bdc.at wrote:

 I changed it this way:

 button.setLayoutParams(new AbsoluteLayout.LayoutParams(width, height, x,
 y));

 -Ursprüngliche Nachricht-
 Von: android-developers@googlegroups.com
 [mailto:android-develop...@googlegroups.com] Im Auftrag von Romain Guy
 Gesendet: Montag, 16. Februar 2009 20:42
 An: android-developers@googlegroups.com
 Betreff: [android-developers] Re: button animation problem


 How do you change the layout params?

 On Mon, Feb 16, 2009 at 7:37 AM, Christian Wiesbauer
 christian.wiesba...@bdc.at wrote:
 Hi,



 I rotate a button 90 degrees anti-clockwise with a RotateAnimation. I
also
 change the position of this button with AbsoluteLayout.LayoutParams. My
 problem is that after these steps the button cannot be clicked or
focused.
 If I click on the old position (before the animation) the onClick event
is
 called. How can I set the click area to the new position? Does
 TouchDelegate do the trick?



 Thanks,



 Christian Wiesbauer



 




 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them



 




-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] button animation problem

2009-02-16 Thread Christian Wiesbauer

Just to understand you correctly!

Also, apply the new layout params when the animation ends.

Do you mean register an AnimationListener and call setLayoutParams(...) in
onAnimationEnd(...)?

-Ursprüngliche Nachricht-
Von: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] Im Auftrag von Romain Guy
Gesendet: Dienstag, 17. Februar 2009 08:25
An: android-developers@googlegroups.com
Betreff: [android-developers] Re: button animation problem


 3. button.setLayoutParams(new AbsoluteLayout.LayoutParams(width, height,
x,
 y));

then requestLayout().

Also, apply the new layout params when the animation ends.


 Do I have to call button.postInvalidate() also?

 -Ursprüngliche Nachricht-
 Von: android-developers@googlegroups.com
 [mailto:android-develop...@googlegroups.com] Im Auftrag von Romain Guy
 Gesendet: Dienstag, 17. Februar 2009 08:01
 An: android-developers@googlegroups.com
 Betreff: [android-developers] Re: button animation problem


 You should also call requestLayout().

 On Mon, Feb 16, 2009 at 10:56 PM, Christian Wiesbauer
 christian.wiesba...@bdc.at wrote:

 I changed it this way:

 button.setLayoutParams(new AbsoluteLayout.LayoutParams(width, height, x,
 y));

 -Ursprüngliche Nachricht-
 Von: android-developers@googlegroups.com
 [mailto:android-develop...@googlegroups.com] Im Auftrag von Romain Guy
 Gesendet: Montag, 16. Februar 2009 20:42
 An: android-developers@googlegroups.com
 Betreff: [android-developers] Re: button animation problem


 How do you change the layout params?

 On Mon, Feb 16, 2009 at 7:37 AM, Christian Wiesbauer
 christian.wiesba...@bdc.at wrote:
 Hi,



 I rotate a button 90 degrees anti-clockwise with a RotateAnimation. I
 also
 change the position of this button with AbsoluteLayout.LayoutParams. My
 problem is that after these steps the button cannot be clicked or
 focused.
 If I click on the old position (before the animation) the onClick event
 is
 called. How can I set the click area to the new position? Does
 TouchDelegate do the trick?



 Thanks,



 Christian Wiesbauer



 




 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them



 




 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them



 




-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---