不解释直接看代码
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) { } }); } }
至于布局自己想像
时间: 2024-11-05 01:27:42