title: Alternative to setAlpha in api level 8
body: <p>I am working on an app, which can run on <code>Froyo</code> as well as <code>JellyBean</code>. I have a class that extends PageTransformer as below:</p>
  
  <pre><code>import android.support.v4.view.ViewPager.PageTransformer;
  import android.view.View;
  
  public class ZoomOutPageTransformer implements PageTransformer {
      private static float MIN_SCALE = 0.85f;
      private static float MIN_ALPHA = 0.5f;
  
      public void transformPage(View view, float position) {
          int pageWidth = view.getWidth();
          int pageHeight = view.getHeight();
  
          if (position &lt; -1) { 
              view.setAlpha(0);
  
          } else if (position &lt;= 1) { 
              float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
              float vertMargin = pageHeight * (1 - scaleFactor) / 2;
              float horzMargin = pageWidth * (1 - scaleFactor) / 2;
              if (position &lt; 0) {
                  view.setTranslationX(horzMargin - vertMargin / 2);
              } else {
                  view.setTranslationX(-horzMargin + vertMargin / 2);
              }
  
  
              view.setScaleX(scaleFactor);
              view.setScaleY(scaleFactor);
  
  
              view.setAlpha(MIN_ALPHA +
                      (scaleFactor - MIN_SCALE) /
                      (1 - MIN_SCALE) * (1 - MIN_ALPHA));
  
          } else { 
              view.setAlpha(0);
          }
      }
  }
  </code></pre>
  
  <p>The problem is, the methods written in this class were added in <code>API level 11</code> and i have minimum sdk version of <code>API level 8</code>. The following are those methods that were added in API level 11:</p>
  
  <ol>
  <li><code>setAlpha()</code></li>
  <li><code>setTranslationX()</code></li>
  <li><code>setScaleX()</code></li>
  <li><code>setScaleY()</code></li>
  </ol>
  
  <p>What can be the solution for this problem ?</p>