1. 程式人生 > >動畫之漸變

動畫之漸變

super content div list ner end oncreate over per

不解釋直接看代碼

public class MainActivity extends AppCompatActivity {

    private RelativeLayout rl;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        rl = (RelativeLayout) findViewById(R.id.rl);
        donghua(rl);
    }
    
public void donghua(View view){ AlphaAnimation alphaAnimation=new AlphaAnimation(1,0);//1,0代表是從實體轉化成透明的 alphaAnimation.setDuration(5000);//這個是顯示的時間 view.startAnimation(alphaAnimation); alphaAnimation.setAnimationListener(new Animation.AnimationListener() { @Override
public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { Intent intent=new Intent(MainActivity.this,HomeActivity.class); startActivity(intent); } @Override
public void onAnimationRepeat(Animation animation) { } }); } }

至於布局自己想像

動畫之漸變