Android:如何在按下时绘制 ImageButton 直到失去焦点?

发布于 2024-10-14 09:14:39 字数 123 浏览 5 评论 0原文

一旦按下,我希望 ImageButton 继续绘制,就像按下它一样,直到触摸其他东西。有没有办法做到这一点,而不是扩展 ImageButton 来控制它的绘制方式,并添加一个焦点侦听器来监视它是否失去焦点?

感谢您。

Once pressed, I would like an ImageButton to continue to draw as if it was pressed until something else is touched. Is there a way to do this short of extending the ImageButton to control how it is drawn, and adding a focus listener to monitor if it loses focus?

Thanks you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深陷 2024-10-21 09:14:39

您可以使用选择器对象而不是位图来在图像按钮中提供所需的效果

更多信息请参见此处 http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList

You can use selectors objects instead of bitmaps to give the desired effect in image buttons

More on this here http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文