title: Full example of how to programmatically do RotateAnimations?
body: <p>I want to have an animation with various steps that do moves (translations) and rotations like "straight on, turn left, straight on, ...." of a car. </p>
  
  <p>I am able to do this in an <code>AnimationSet</code>, but fail at rotating around the center of my car image with the "RELATIVE_TO_SELF" setting. I know about</p>
  
  <pre><code>Animation a = new RotateAnimation(0,90,Animation.RELATIVE_TO_SELF,0.5f,... )
  </code></pre>
  
  <p>for this purpose. Still the rotation occurs around the upper left corner of the screen (or canvas?).</p>
  
  <p>Currently I am solving this by manually keeping track of the position after each animation step, but this is suboptimal.</p>
  
  <p>I suspect that my initial layout setup is bogus:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"
  &gt;
      &lt;FrameLayout
              android:layout_height="wrap_content"
              android:layout_width="fill_parent"&gt;
  
          &lt;!-- view that draws some background --&gt;
          &lt;de.bsd.turtlecar.SampleView android:id="@+id/graph_view"
                android:layout_height="350px"
                android:layout_width="fill_parent"
                android:visibility="invisible"
                /&gt;
  
          &lt;!-- the car --&gt;
          &lt;ImageView android:id="@+id/car_view"
                     android:src="@drawable/turtle_car"
                     android:layout_height="wrap_content"
                     android:layout_width="wrap_content"
                     android:visibility="invisible"/&gt;
  
  
      &lt;/FrameLayout&gt;
  
     &lt;Button ... onClick="run" ... /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>This shows the car in the upper left corner (should show up in a different place -- basically where the animation later starts. And it should be move later).</p>
  
  <p>In my code that is triggered through the run button I do:</p>
  
  <pre><code>    ImageView carView = (ImageView) findViewById(R.id.car_view);
      print(carView);
      AnimationSet animationSet = new AnimationSet(true);
  
      TranslateAnimation a = new TranslateAnimation(
              Animation.ABSOLUTE,200, Animation.ABSOLUTE,200,
              Animation.ABSOLUTE,200, Animation.ABSOLUTE,200);
      a.setDuration(1000);
      animationSet.addAnimation(a);
  
      RotateAnimation r = new RotateAnimation(0f, -90f,200,200); // HERE 
      r.setStartOffset(1000);
      r.setDuration(1000);
      animationSet.addAnimation(r);
      ...
  </code></pre>
  
  <p>So at the point with here, the rotation works, but I have to keep track. if I rotate RELATIVE_TO_SELF, the rotation happens around (0,0) of the screen.</p>
  
  <p>Additional question: what can I do in order to keep the car on screen after the animation has finished?</p>
  
  <p>Or am I completely on the wrong track?</p>