How to increase the font size of an Edittext according to the screen size?

Asked

Viewed 6,204 times

5

I would like the font size to be proportional to the screen size of the device running the application.

1 answer

3


you can create a file dimens.xml for each type/screen resolution:

1) Create a folder values for resolutions you want to treat individually, example: values-hdpi, values-mdpi etc..

2) Inside the archive dimens.xml from each folder create an item dimen (with the same name in all):

<dimen name="txt_size">12sp</dimen>

3) Now, within your EditText:

android:textSize="@dimen/txt_size"

You can check the full list of resolutions through the official documentation: http://developer.android.com/guide/topics/resources/providing-resources.html

Browser other questions tagged

You are not signed in. Login or sign up in order to post.