【发布时间】:2011-10-28 23:55:15
【问题描述】:
我有一个显示项目列表的应用程序。我需要在主要活动开始之前显示淡出图像。 我试过类似的东西 在我开始的主要活动的 onCreate 方法中 一个动画活动,如
Intent animationIntent=new Intent(this,AnimationActivity.class);
startActivityForResult(AnimationIntent);
在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);
我的 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>
这种方法的问题是它显示一个动画,但图像视图会出现一段时间,主要活动带有幻灯片过渡效果
但我希望我的图像淡出,我的活动应该淡入
任何帮助将不胜感激。提前致谢
【问题讨论】:
-
@user609765 如果答案解决了您的问题,请您接受
标签: android