相关疑难解决方法(0)

如何在android中实现启动画面

我有一个显示项目列表的应用程序.我需要在主要活动开始前显示淡出图像.我在onCreate主要活动方法中尝试了类似的东西,我开始了一个动画活动

Intent animationIntent=new Intent(this,AnimationActivity.class);
startActivityForResult(AnimationIntent);
Run Code Online (Sandbox Code Playgroud)

在AnimationActivity.class的onCreate方法中

super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    ImageView introanim = (ImageView) findViewById(R.id.imgView);
    AnimationSet StoryAnimation = (AnimationSet)AnimationUtils.
loadAnimation(this, R.anim.alphanim);
StoryAnimation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onAnimationRepeat(Animation animation) {
                AnimationSubActivity.this.finish();

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            AnimationSubActivity.this.finish();
        }
    });

    introanim.clearAnimation();
    introanim.startAnimation(StoryAnimation);
Run Code Online (Sandbox Code Playgroud)

我的main.xml是

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView  
android:id="@+id/imgView"
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:src="@drawable/icon"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这种方法的问题在于它显示了一个动画,但是imageview来了一段时间,主要活动带有幻灯片过渡效果

但我希望我的形象淡出,我的活动应该淡入

任何帮助将不胜感激.提前致谢

android

15
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1