问题描述
我已经在Android Studio中制作了此圆形按钮:
I've made this circular button in Android Studio:
我使用了自定义背景.问题是图像中突出显示的黄色区域是可单击的.我想将可点击区域缩小为红色圆圈.
I used a custom backgroud. The problem is that the highlighted yellow area in the image, is clickable. I want to reduce the clickable area to just the red circle.
有什么办法做这种事吗?
Is there any way to do such thing?
推荐答案
您无法删除图像的透明区域.因为它是图像的一部分.
You cannot remove that transparent area of your image. Because it's a part of your image.
任何类型的图像始终具有矩形形状.如果图像的角是透明的,并不意味着这些角上的像素与图像分离!那些像素始终被图像占据,并且您无法删除该区域.
Any kind of image always have rectangular shape. If the corners of the image are transparent, doesn't mean those pixels at the corner are separated from the image! Those pixels are always occupied by your image and you cannot remove that area.
尚未创建可将图像的透明区域与图像本身分开的库.
No library yet created that can apart transparent area of an image from image itself.
这篇关于Android圆形按钮可点击区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!