Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - Translating view bigger than screen size causes smearing
    text
    copied!<p>I am trying to make a game with several "screen". If the user goes to the edge of a screen, an animation should pop in that shifts out the current screen and shifts in the new screen.</p> <p>I wanted to do this with a TranslateAnimation. First I calculate an bitmap which contains the first and the second screen and then i want to play this in the view 'transitionView' while i hide the view 'levelView', which originally contained the first screen. After the transition is finished, i want to hide 'transitionView' again and display the new screen in 'levelView'.</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/viewGroup" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;view class="at.test.game.ScreenTransitionTest2$LevelView" android:id="@+id/levelView" android:layout_width="match_parent" android:layout_height="match_parent"/&gt; &lt;view class="at.test.game.ScreenTransitionTest2$TransitionView" android:id="@+id/transitionView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone"/&gt; &lt;/RelativeLayout&gt; </code></pre> <p>I first tried to to it with an ImageView, but it would always scale down the bitmap regardless of the settings i used. So I now created my own View, which just draws the image from (0, 0). Since clipping occured, I disabled it in the onCreate method:</p> <pre><code>((RelativeLayout)findViewById(R.id.viewGroup)).setClipChildren(false); </code></pre> <p>The animation looks like this:</p> <pre><code>this.transitionView.setBitmap(calculateBitmap(screen1, screen2)); TranslateAnimation a = new TranslateAnimation( Animation.ABSOLUTE, startx, Animation.ABSOLUTE, endx, Animation.ABSOLUTE, starty, Animation.ABSOLUTE, endy); a.setDuration(3000); a.setFillAfter(true); this.transitionView.setAnimation(a); a.start(); </code></pre> <p>My problem: Only 480x800 of the bitmap is rendered/moved correctly (the bitmap is about 1000x880 and its starting coordinates are like (-40, -40), endcoordinates (-520, -40)) outside this area (so on the bottom of the screen and to the right as the 2nd frame should move in) instead of displaying the rest of the bitmap nothing is drawn or just smeared (see screenshot)</p> <p>Why does the bitmap not get correctly drawn in the animation? Did I miss some settings? I tried 'wrap_content' for the viewgroup, but that did not help either. Or is it just not possible to slide bigger bitmaps through the whole screen?</p> <p><a href="http://stuff.schoellhammer.at/smearing.png" rel="nofollow">screenshot - nothing is drawn on bottom and smearing occurs on the right</a></p>
 

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