• 软件的开启动画设置


    布局:

               

           <ImageView
                 android:id="@+id/dongman"
                 android:layout_width="match_parent"
                 android:layout_height="fill_parent"
                 android:src="@drawable/kaiqi" />

    代码:

    public class dongman extends Activity{
    private ImageView welcomeImg = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.dongman); //我的布局的名字
    welcomeImg = (ImageView) this.findViewById(R.id.dongman); //控件
    AlphaAnimation anima = new AlphaAnimation(0.3f, 1.0f); //动漫相关的类
    anima.setDuration(3000);// 设置动画显示时间
    welcomeImg.startAnimation(anima); //welcomeimg(ImageView控件名)启动动画(动画);这里是设置为启动动画的关键
    anima.setAnimationListener(new AnimationImpl()); //动画设置监听

    }

    private class AnimationImpl implements AnimationListener { //这里继承了动画监听的类

    @Override
    public void onAnimationStart(Animation animation) {
    // welcomeImg.setBackgroundResource(R.drawable.ic_launcher);   这里是设置背景图片的
    }

    @Override
    public void onAnimationEnd(Animation animation) {
    skip(); // 动画结束后跳转到别的页面
    }

    @Override
    public void onAnimationRepeat(Animation animation) { //这里设置动画的重复

    }

    }

    private void skip() {
    startActivity(new Intent(this, main.class));
    finish();
    }
    }

    然后将这个类设置为主类就可以使用的

  • 相关阅读:
    JAVA应用程序占用CPU、内存过高分析过程
    html和css问题?
    html跳动的心实现代码
    css知识点总结
    html注册栏网页练习代码
    前端开发单词大全
    html常用代码合集
    html背景图星际导航图练习
    html迪士尼网页实现代码
    html阿里云网页练习实现代码
  • 原文地址:https://www.cnblogs.com/laijinquan/p/5947837.html
Copyright © 2020-2023  润新知