Issue
I'm developing an app that targets only Android Phones, not tablets. The app should work in portrait mode only. I have all the dimensions (for views and fonts) in a dimens.xml file in the values folder.
I want to adjust the appearance for some commonly used phones, for example
- Galaxy S2: 240dpi, 480x800
- Nexus 4: 320 dpi, 768x1184
- Nexus 5: 480 dpi, 1080x1800
I want to specify some font size and view dimensions specifically for these targets. I've tried with a lot of different values folder names, for example:
values-sw240dp values-sw480dp values-sw320dp, and so on,
but the app uses always the same folder for the three devices (normally the 480dp folder).
It is possible to specify dimensions in a resource file targeted for these devices?
Thank you in advance!
PS: excuse my bad English.
Solution
Yes it is possible. Every single folder inside the /res/
folder works exactly the same regarding those filters (xhdpi, sw600dp, en, land, etc).
The problem on your case is that you did not specify the correct folders. And the correct folders depends on what is the parameter you're using to specify the different dimensions.
sw___dp
is for "smallest width", meaning, the smallest width of the screen (in a 800x480 phone is the 480 side) is that amount of DPs.to specify DPIs you probably want to use
hdpi
,xhdpi
,xxhdpi
. Which will fit into those 3 devices you mention.If you really want to use
sw___dp
, you probably want to install THIS APP on the devices and it shows you the sizing inDP
for each screen (alternatively, if you don't have the devices, you'll have to do some math.
Answered By - Budius
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.