动画淡入和淡出 [英] animation fade in and out
本文介绍了动画淡入和淡出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用这个code我已经只是一个褪色,我寻找有关还添加淡出。我想补充另一个XML所谓的淡出,但我不能在我的code集成了。
的ImageView ImageView的=(ImageView的)findViewById(R.id.imageView);
动画fadeInAnimation = AnimationUtils.loadAnimation(这一点,R.anim.fadein);
imageView.startAnimation(fadeInAnimation);
button1.setOnClickListener(新View.OnClickListener(){
公共无效的onClick(视图v){
imageView.startAnimation(fadeInAnimation);
XML
< XML版本=1.0编码=UTF-8&GT?;
<设置的xmlns:机器人=http://schemas.android.com/apk/res/android>
<阿尔法机器人:fromAlpha =0.0的Android版本:toAlpha =1.0
机器人:插=@机器人:动画/ accelerate_interpolator
机器人:时间=你的时间(以milisecond)
安卓的repeatCount =无限/>
< /集>
解决方案
这是良好先例 淡入和淡出动画使用Alpha效果
更新:
检查这回答可能会在此帮你
Using this code I've only a fade in, I looking for about add also a fade out. I add another xml called "fadeout" but I can't integrate it in my code.
ImageView imageView= (ImageView)findViewById(R.id.imageView);
Animation fadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fadein);
imageView.startAnimation(fadeInAnimation );
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
imageView.startAnimation(fadeInAnimation);
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="Your Duration(in milisecond)"
android:repeatCount="infinite"/>
</set>
解决方案
This is Good Example for Fade In and Fade Out Animation with Alpha Effect
UPDATED :
check this answer may this help you
这篇关于动画淡入和淡出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文