Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since you're using API11, use the <a href="http://developer.android.com/reference/android/animation/Animator.html" rel="noreferrer">Animator API</a>. All views have properties now with corresponding setters and getters. To shift a view to the left out of scope, get the width of the screen then do:</p> <pre><code>View viewToShiftOut = getOutView(); ObjectAnimator outAnim = ObjectAnimator.ofFloat(viewToShiftOut, "x", 0, -widthOfScreen); outAnim.setDuration(1000); outAnim.start(); </code></pre> <p>This will shift the view and it's contents entirely out of the screen for a duration of 1 second (1000 miliseconds). To shift one in it's place do this:</p> <pre><code>View viewToShiftIn = getInView(); ObjectAnimator inAnim = ObjectAnimator.ofFloat(viewToShiftIn, "x", widthOfScreen, 0); inAnim.setDuration(1000); inAnim.start(); </code></pre> <p>All the properties, clickable areas, etc. will follow the view so you'll be done when the animations finish. You can animate them together like so:</p> <pre><code>View viewToShiftOut = getOutView(); View viewToShiftIn = getInView(); ObjectAnimator outAnim = ObjectAnimator.ofFloat(viewToShiftOut, "x", 0, -widthOfScreen); ObjectAnimator inAnim = ObjectAnimator.ofFloat(viewToShiftOut, "x", widthOfScreen, 0); outAnim.setDuration(1000); inAnim.setDuration(1000); outAnim.start(); inAnim.start(); </code></pre> <p><a href="http://android-developers.blogspot.com/2011/05/introducing-viewpropertyanimator.html" rel="noreferrer">Blog post</a></p> <p>EDIT: I noticed you wanted to only shift the view by a 1/3rd, so you can get the amount of pixels to shift each by <code>widthOfScreen/3</code>.</p> <p>EDIT 2: Another advantage is you can use it with hardware acceleration without trouble which most 3.0+ tablets have.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload