如何做一个图像的淡入一个Android活动屏幕上?图像、如何做一个、屏幕上、Android

2023-09-12 22:44:17 作者:對於你、虛偽

我想和做渐进和持续的淡入从苍白单调乌贼最终全彩显示屏在Android活动屏幕上的照片。我知道怎么做了一个Java图片/ BufferedImage的图形对象,但不幸的是我什么都不知道为Android编程环境。谁能帮忙?

I'd like to display a photo on an Android Activity screen with doing gradual and continual fade-in from pale monotone sepia to the final full color. I know how to do it on a Java Image/BufferedImage for the Graphic object but unfortunately I know nothing for the Android programming environment. Could anyone help?

推荐答案

喜弘,你可以在褪色做到这一点:

Hi Hiroshi you can do this for the fade in:

  ImageView myImageView= (ImageView)findViewById(R.id.myImageView);
  Animation myFadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fadein);
  myImageView.startAnimation(myFadeInAnimation); //Set animation to your ImageView

和你的资源内\动画\文件夹中的动画文件fadein.xml

and inside your res\anim\ folder the animation file 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