zoukankan      html  css  js  c++  java
  • 软件的开启动画设置

    布局:

               

           <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();
    }
    }

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

  • 相关阅读:
    ubuntu12.04 安装完XRDP显示空白桌面
    安装完CUDA Toolkit,VS2010调试项目控制台一闪而过
    控制台连接oracle11g报ORA-12560异常
    @Autowired和@Resource
    @Autowire和@Resource区别
    springMVC
    springmvc常用注解标签详解
    Spring/SpringMvc 配置文件常用标签解释
    java中volatile不能保证线程安全(实例讲解)
    volatile关键字解析
  • 原文地址:https://www.cnblogs.com/laijinquan/p/5947837.html
Copyright © 2011-2022 走看看