I'm using several buttons in my app, but both layout_width/height "wrap_content" and "fill_parent" looks weird. The former being to small and the latter too large - both looks weird, and the former is not easy to hit with your finger.
How should I size buttons? Is it typical to define their sizes in dip? Or should I use "fill_parent" with a padding? Buttons looks weird in my app, not so in others.
Consider making touch targets at least 48 x 48 dp, separated by 8 dp of space or more, to ensure balanced information density and usability. A touch target of 48 x 48 dp results in a physical size of about 9 mm, regardless of screen size.
Button Spacing Standard And when the buttons were too close together, users had the lowest touch accuracy. The study concluded that a range of 12 to 48 pixels is the optimal button spacing. This wide range is useful because you can apply it to different button sizes.
Studies by the MIT Touch Lab suggests that 10mm x 10mm is the best minimum size for buttons due to the average size of fingertips. Designing buttons must not only be pleasing to the eye, but they also need to make tactile sense for the user.
That is difficult to answer in the abstract. Here are some techniques to consider:
Use android:padding="4dip"
(or some other value) to make a wrap_content
Button
a bit bigger
Use android:textSize
on the Button
to make the content bigger (use some size in scaled pixels, or sp
)
If you want the buttons to fill the space but divide it among themselves, use a LinearLayout
, give each button a height (or width, depending if column or row) of 0px
, then use android:layout_weight
to allocate space between them on a percentage basis. Here is a sample project outlining this technique.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With