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.
Asked
Active
Viewed 319 times
0
-
are you using `android:textSize` with sp (scalled pixels) in your layout? – Karol Żygłowicz Jul 29 '15 at 11:37
-
s but not working for all screens – Sabish.M Jul 29 '15 at 11:38
-
can you please show some code of how you set the text size? – mismor Jul 29 '15 at 11:39
-
Please provide more Information. Are you using a TextView or do you draw with canvas or anything else? – daemmie Jul 29 '15 at 11:40
-
write different size in dimensions for different screen size. – Nivedh Jul 29 '15 at 11:42
-
@sabish did you solve this ? – IntelliJ Amiya Aug 20 '16 at 06:49
2 Answers
1
Try this Demo Git Project Android-autofittextview.It may help you.In your layout add like this to mention size android:textSize="@dimen/_15sdp"
.

IntelliJ Amiya
- 74,896
- 15
- 165
- 198
-
-
Its not possible .How can you set very long text in single line .http://stackoverflow.com/questions/25247018/android-textview-singleline-field-hides-long-text – IntelliJ Amiya Jul 29 '15 at 11:59
0
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)

MHP
- 2,613
- 1
- 16
- 26