【问题标题】:Android :: Image click animationAndroid :: 图片点击动画
【发布时间】:2011-02-06 06:41:36
【问题描述】:

这是我在 Android 中的要求。我需要显示一个小图像。当用户按下图像时,图像应该会稍微放大并回到原来的位置,从而给人一种图像已被点击的印象。 我该怎么做呢? (我尝试在 imageview 中使用 2 个不同的图像(使用图像选择器),但是两个图像都被缩放到视图大小,因此没有可见的动画)

请帮忙。

问候, 山姆

【问题讨论】:

    标签: android imageview


    【解决方案1】:

    如果您只想在按下时增加图像大小(没有动画) - 选择器是正确的方法,它应该可以工作。

    可能是您为 ImageView 设置了错误布局参数或 scaleType。

    如果您想看到流畅的动画,当用户点击 imageview 时,您应该将 onClickListener 添加到您的 ImageView 并在 onClick 处理程序上添加适当的动画。

    【讨论】:

    • schemas.android.com/apk/res/android">
    • 感谢科罗维扬斯克的回复!
    • schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" >
    • schemas.android.com/apk/res/android">
    • Korovyansk,将我的代码粘贴到之前的 cmets 中。如果我在代码中做错了什么,请告诉我。你也可以给我一些关于在 onClick 处理程序上处理动画的指示。对不起,我是新手,努力! :-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多