10

Is there a way to auto adjust the text size of a button to be the biggest it can be while stayinh one line, and still fit in the button?

Chikal Tretz
  • 131
  • 1
  • 7
  • 1
    There's no native support. What you're looking for is here: [Question asked in another thread](http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds) – Wes Winn Jan 15 '14 at 22:44
  • whenever I've ported these auto-resize TEXTVIEW examples to extend BUTTON, they don't work ! Would be sweet to see a working Button example with auto-resizable text – Someone Somewhere Apr 03 '16 at 15:57

1 Answers1

0

Have a look at Autosizing TextViews (provides support to API level 14).

For example

<Button
    android:id="@+id/button"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:maxLines="1"
    android:text="Some text"
    app:autoSizeTextType="uniform" />

The key property here is app:autoSizeTextType

Vasily Kabunov
  • 6,511
  • 13
  • 49
  • 53