Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
720 views
in Technique[技术] by (71.8m points)

xml - Android hdpi/mdpi/ldpi for Values folder?

Android allows us to define hdpi/mdpi/ldpi for the drawable folder in order to account for different sized screens/devices. I was wondering if that same support can be applied for the Values folder (or even the layout folder)? Reason being, I typically define a "sizes.xml" file which holds standard dp sizes that I apply to margins and paddings. I also do the same for sp sizes for text. I'd like to adjust those values based on the phones dpi.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Yes, you can. Just like this:

res/values/dimens.xml(default)
res/values-ldpi/dimens.xml   (240x320 and nearer resolution)
res/values-mdpi/dimens.xml   (320x480 and nearer resolution)
res/values-hdpi/dimens.xml   (480x800, 540x960 and nearer resolution)
res/values-xhdpi/dimens.xml  (720x1280 - Samsung S3, Micromax Canvas HD, etc) 
res/values-xxhdpi/dimens.xml (1080x1920 - Samsung S4, HTC one, etc)
res/values-large/dimens.xml  (480x800)

res/values-large-mdpi/dimens.xml (600x1024)
res/values-sw600dp/dimens.xml  (600x1024)
res/values-sw720dp/dimens.xml  (800x1280)
res/values-xlarge-xhdpi/dimens.xml (2560x1600 - Nexus 10")
res/values-large-xhdpi/dimens.xml  (1200x1920 - Nexus 7"(latest))

(from: http://wiki.jikexueyuan.com/project/android-actual-combat-skills/multi-resolution-adapting-common-directory.html Warning: the link is chinese!!! To translate, right click on the page, click "translate to English" in the popup menu.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...