机器人的ImageView的onClick动画 [英] android imageview onClick animation

查看:143
本文介绍了机器人的ImageView的onClick动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想这是一种奇怪的问题,但我已经尝试设置onClicklistener上ImageView的,它已经奏效。但问题是,用户无法感知的点击。我的意思是如果一些的U工作过的其他移动周围(如苹果iPhone),然后文,我们在其他周围一个图片然后双击它给人的形象产生影响,使用户能理解图像已被点击。

我已经尝试设置阿尔法使用setalpha方法,但它不工作。虽然同样的事情正在罚款onFocusListener实施。 some1能否提供一种不同的方式来修改点击图片...

我是新到Android所以还没有学会了简单的动画也有细微差别......如果有任何简单的动画,我可以使用相同的,那么plzz plzzz让我知道...

感谢名单...

解决方案

 < XML版本=1.0编码=UTF-8&GT?;
<设置的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android>

<阿尔法
机器人:fromAlpha =1.0
机器人:toAlpha =0.5
机器人:时间=300>
< /阿尔法>
<规模
机器人:fromXScale =1
机器人:toXScale =0.9
机器人:fromYScale =1
机器人:toYScale =0.9
机器人:pivotX =50%
机器人:pivotY =50%
机器人:时间=50>
< /规模与GT;
< /集>
 

我不知道这是否是正确的方法,但定义动画中提到的伎俩。现在,我们只需要给

 公共无效的onClick(视图v){
v.startAnimation(AnimationUtils.loadAnimation(背景下,R.anim.image_click));
//你的其他的编码,如果present
}
 

在onclick方法和变化将是明显的...

I guess this is kind of an odd question but i have tried setting onClicklistener on an ImageView and it has worked. But the problem is that the user cannot sense the click. I mean if some of u have worked on other mobile environs(like apple iphone) then wen we click on a Image in other environs then it gives an effect on the image so that the user can understand that the image has been clicked.

I have tried setting alpha using "setalpha" method but it doesnt work. Though the same thing is working fine on onFocusListener implementation. Can some1 suggest a different way to modify the image on click...

I am new to android so havent learnt the nuances of simple animation also... if there is any simple animation i can use for the same then plzz plzzz let me know...

Thanx...

解决方案

   <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">

<alpha
android:fromAlpha = "1.0"
android:toAlpha = "0.5"
android:duration = "300">
</alpha>
<scale
android:fromXScale = "1"
android:toXScale = "0.9" 
android:fromYScale = "1"
android:toYScale = "0.9" 
android:pivotX="50%"
android:pivotY="50%" 
android:duration = "50">
</scale>
</set>

I don't know if this is the correct method but defining an animation as mentioned did the trick. Now we just have to give

public void onClick(View v) {
v.startAnimation(AnimationUtils.loadAnimation(Context, R.anim.image_click));
//Your other coding if present
}

in the OnClick method and the change will be visible...

这篇关于机器人的ImageView的onClick动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆