Sabish.M
Sabish.M

Reputation: 2060

How to change Text Size for differrent screen size?

I am making Game with android studio everything is completed but only one issue i have. Text size's not changed. How to make it for auto fit on any screen like phones and tablets.

Upvotes: 0

Views: 327

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75778

Try this Demo Git Project Android-autofittextview.It may help you.In your layout add like this to mention size android:textSize="@dimen/_15sdp".

Upvotes: 1

MHP
MHP

Reputation: 2731

you can use this library to auto fit your text depend on TextView width.
also you need to set android:textSize in dimens.xml like this:

<TextView
    android:id="@+id/textview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="@dimen/textsize"/>

for have different size for different devices just define dimens.xml for different screen size (for example: Value-large)

Upvotes: 0

Related Questions