andriod effect

public class EffectDeal
{
   
    private Activity myActivity;
   
    private Class<?> myClasses;
   
    public EffectDeal(Activity activity,Class<?> classes)
    {
        this.myActivity = activity;
        this.myClasses = classes;
    }
   
    public void fadeDeal(int delayMillis)
    {
        new Handler().postDelayed(new Runnable()
        {
           
            @Override
            public void run()
            {
                Intent intent = new Intent(myActivity,myClasses);
                myActivity.startActivity(intent);
                myActivity.finish();
               
                /*
                 * 淡入淡出的效果
                 */
                myActivity.overridePendingTransition(R.anim.fade_in,R.anim.fade_out);
               
                /*
                 * 由左向右滑入的效果
                 */
                //myActivity.overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_right);
            }

        },  delayMillis);
    }
   
}

你可能感兴趣的:(effect)