I have a ImageView
with a 24x24 dp icon, so the complete ImageView
and touch area is only 24x24dp, while the recommended minimum touch target area is 48x48dp.
What's the common way to increase the ImageView
touch area size? I can add a padding of 12 dp on each side manually (24 + 12 + 12 = 48 dp), but is there any better way? Especially if the ImageView
size changes I have to adjust padding manually, that's very error prone.
You can set the size of the ImageView
to the size of the touchable area.
Then you set the scale type attribute of the ImageView
to achieve the desired effect. In your case (icon is likely to be smaller than 48dp
x 48dp
) this could be android:scaleType="center"
or android:scaleType="centerInside"
.
See the documentation for a description of all options