How to do this animation in xml

Put your problem here if it does not fit any of the other categories.

How to do this animation in xml

Postby MrSnowflake » Sun Oct 19, 2008 3:09 pm

I have this animation, I wish to do in xml. But it seems to me it's not possible, so I hope I'm mistaking and someone can help me with it.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. //Out animation
  3.  
  4. Animation anim = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0.0f,
  5.  
  6.                         TranslateAnimation.RELATIVE_TO_PARENT, 1.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f,
  7.  
  8.                         TranslateAnimation.RELATIVE_TO_PARENT, 0.0f);
  9.  
  10. anim.setDuration(2000);
  11.  
  12.  
  13.  
  14. //In animation
  15.  
  16. anim = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, -1.0f,
  17.  
  18.                         TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f,
  19.  
  20.                         TranslateAnimation.RELATIVE_TO_PARENT, 0.0f);
  21.  
  22. anim.setDuration(2000);
  23.  
  24.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Postby MrSnowflake » Sun Oct 19, 2008 11:34 pm

I've found it:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <translate xmlns:android="http://schemas.android.com/apk/res/android"
  3.  
  4.         android:fromXDelta="-100%p"
  5.  
  6.         android:toXDelta="0%p"
  7.  
  8.         android:duration="400"/>
  9.  
  10.  
Parsed in 0.001 seconds, using GeSHi 1.0.8.4

The p after fromXDelta="-100%p" tells us it's relative to parent, it only works with % though.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 27 guests