Android examples for User Interface:View Animation
Set View Alpha animation
//package com.java2s; import android.annotation.SuppressLint; import android.os.Build; import android.view.View; import android.view.animation.AlphaAnimation; public class Main { @SuppressLint("NewApi") public static void SetAlpha(View view, float alpha) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { view.setAlpha(alpha);//from w w w . j av a 2 s . co m } else { AlphaAnimation a = new AlphaAnimation(alpha, alpha); a.setDuration(0); a.setFillAfter(true); view.startAnimation(a); } } }