由网友(№独特的→神经范)分享简介:使用这个code我已经只是一个褪色,我寻找有关还添加淡出。我想补充另一个XML所谓的淡出,但我不能在我的code集成了。的ImageView ImageView的=(ImageView的)findViewById(R.id.imageView);动画fadeInAnimation = AnimationUtils.l...
使用这个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
Animate Fade In Fade Out
UPDATED :
check this answer may this help you
相关推荐
最新文章