title: android transition background of view from one color to another
body: <p>I have a view with a black background with transparency: #DD000000</p>
  
  <p>What I want is that the view, in some circumstances, transitions from #223333FF back to the first color.</p>
  
  <pre><code>//lastApp.setBackgroundColor(getResources().getColor(R.color.semitransparent));
  ColorDrawable[] color = {new ColorDrawable(Color.BLUE), new ColorDrawable(Color.BLACK)};
  TransitionDrawable trans = new TransitionDrawable(color);
  int sdk = android.os.Build.VERSION.SDK_INT;
  if(sdk &lt; android.os.Build.VERSION_CODES.JELLY_BEAN) {
      lastApp.setBackgroundDrawable(trans);
  } else {
      lastApp.setBackground(trans);
  }
  trans.startTransition(300);
  </code></pre>
  
  <p>This code works, but the colors are not the ones I want.</p>
  
  <p>If I use the next line I believe it creates two Black colors, because I don't see any blue, and the transparency is lost.</p>
  
  <pre><code>ColorDrawable[] color = {new ColorDrawable(getResources().getColor(R.color.blue)), new ColorDrawable(getResources().getColor(R.color.black_overlay))};
  </code></pre>
  
  <p>My next attempt was using resources without the alpha: #DD000000 -> #000000; #223333FF -> #3333FF
  Here the transition worked, but it wasn't what I wanted as there was no transparency.</p>
  
  <p>The next two attemps were simply trying something new, as I want to use color resources.</p>
  
  <p>With the next line I get a black without transparency.</p>
  
  <pre><code>ColorDrawable[] color = {new ColorDrawable(0x223333FF), new ColorDrawable(0xDD000000)};
  </code></pre>
  
  <p>This results in a final blueish color, instead of transparent black</p>
  
  <pre><code>ColorDrawable[] color = {new ColorDrawable(0x223333FF), new ColorDrawable(0x33000000)};
  </code></pre>
  
  <p>I have also tried, with no effect: </p>
  
  <pre><code>color[1].setAlpha(50);
  </code></pre>
  
  <p>So, what am I doing wrong? Or is there a better way of accomplishing this?</p>