[英]How to shrink/decrease the hit area of a button in android?
我已经尝试过TouchDelegate,据说可以实现这一目标。 它适用于增加命中区域,但不能减少命中区域。
我们可以在xml文件中更改命中区域吗?
我的测试代码只是从扩展子视图的可触摸区域复制,其中说“如果需要,你也可以使用这种方法缩小孩子的触摸区域。”。
在您提供的链接中:
// Extend the touch area of the ImageButton beyond its bounds
// on the right and bottom.
delegateArea.right += 100;
delegateArea.bottom += 100;
将其更改为:
delegateArea.right -= 100;
delegateArea.bottom -= 100;
现在你将获得理想的结果。 您可能希望将值从100更改为您认为合适的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.