Habeeb
Habeeb

Reputation: 8007

How to set dimensions for different Screens in Android development

I am new to the Android development environment.
I would like to have my app designed for multiple phone screen sizes and resolutions.
If the design for all the screens remain the same, will I be able to use one XML layout for the design with the dimensions specified in "dp" and "sp".
Will android automatically scale the dimensions and font sizes for each phones(ldpi, mdpi, hdpi, xdpi, xxdpi, xxxdpi) automatically? Or do I have to create separate layout files for each of them with the respective dp/sp values?
Also, I hope if I put images for each dip in their respective folders, android would pick it up by itself.

Upvotes: 0

Views: 603

Answers (1)

Madi
Madi

Reputation: 1855

Create layouts for screens like this:

res/layout/my_layout.xml // layout for normal screen size ("default")

res/layout-large/my_layout.xml // layout for large screen size

res/layout-xlarge/my_layout.xml // layout for extra-large screen size

res/layout-xlarge-land/my_layout.xml // layout for extra-large in landscape orientation

res/drawable-mdpi/graphic.png // bitmap for medium-density

res/drawable-hdpi/graphic.png // bitmap for high-density

res/drawable-xhdpi/graphic.png // bitmap for extra-high-density

res/drawable-xxhdpi/graphic.png // bitmap for extra-extra-high-density

Upvotes: 1

Related Questions