Android:如何在按下时绘制 ImageButton 直到失去焦点?
一旦按下,我希望 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用选择器对象而不是位图来在图像按钮中提供所需的效果
更多信息请参见此处 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