bvk256
bvk256

Reputation: 1893

Scaling text to fit inside the button in Android

I have the button layout as on the picture. Currently the text size is default, but on some devices the text doesn't fit the button as you can see on the screenshot (on most devices it's ok).

How can I set the text size in such a way that the text would fit inside all buttons? enter image description here

Upvotes: 0

Views: 71

Answers (1)

ghost talker
ghost talker

Reputation: 392

Here are some of the tips that can be good in your particular problems. There are 2 ways to control it and these are

  1. Set the gravity button to center so that text could be centralized inside button.
  2. Put different sp values of text in the value folder of your project so that it can be large and small depending on device size and density. this would help you in controlling the size of text and to look good across other devices.

Upvotes: 2

Related Questions