我想在 Android Activity 屏幕上显示一张照片,从浅单调的棕褐色到最终的全彩色逐渐和连续地淡入。我知道如何在 Graphic 对象的 Java Image/BufferedImage 上执行此操作,但不幸的是我对 Android 编程环境一无所知。有人可以帮忙吗?
最佳答案
嗨 Hiroshi,您可以为淡入执行此操作:
ImageView myImageView= (ImageView)findViewById(R.id.myImageView);
Animation myFadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fadein);
myImageView.startAnimation(myFadeInAnimation); //Set animation to your ImageView
在你的 res\anim\文件夹中动画文件fadein.xml
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="3000"/>
</set>
但是对于从棕褐色到全色的逐渐淡入,您必须使用 TransitionDrawable
关于android - 如何在 Android Activity 屏幕上淡入图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2597329/