erika
erika

Reputation: 124

How to support large screen size with normal dp?

I'm trying to support multiple screen size in my Android app. I use the AVD manager to create various screen sizes. One of them is 400x800 size MDPI. Since the screen size is larger than the common MDPI screen sizes (320x480), the text size looks smaller in this emulator. I tried to create a new qualifier, values-large, and set larger text size (dimens.xml) in that folder, but it fails (the emulator still uses the dimens specified in values folder).

I know that we could specify minimum screen width, e.g. values-sw600dp, however how can I know the dp of that device (400x800 size - mdpi)? Can anybody help me on this? Thanks a lot!

Upvotes: 1

Views: 122

Answers (2)

Hitman
Hitman

Reputation: 598

As far as I know if you use in the xml files dip values than you will support every screen size

Upvotes: 0

Coderji
Coderji

Reputation: 7765

you can use Log.d("Denisity",String.valueOf(getApplicationContext().getResources().getDisplayMetrics().density)); to know the density of the device if you have it the value will be as the

following: 0.75 means low density.

1.0 means midum density.

1.5 means high density.

2.0 means extra high density.

then you can have if statement that if the device has the mdpi size with that density change the text size.

Upvotes: 2

Related Questions