Closed veyndan closed 7 years ago
All of the dimensions are used to set the size of the views and stuff.
With different dimens files, you can have custom sizes for Android devices with different dpis.
For example, an ldpi device needs separate dimensions from an xxxhd device.
Open the main activity in Android Studio, and compare previews. If you set the preview device to a ldpi device, the UI is broken.
Varying dimensions based on screens fixes this.
Possibly instead of removing the dimens folders, replacing the qualifier would be better. My assumption is that you want the size to change based on the width of the device, which is separate from that of dpi. The only reason that varying dpi in the preview appears to fix this as the ldpi devices provided have smaller width than that of the hdpi, xhdpi etc. counterparts.
Also looking at some of the dimens you've listed, it doesn't appear to make any sense. Take text_size_button
for example.
<dimen name="text_size_button_ldpi">12dp</dimen>
<dimen name="text_size_button_mdpi">19dp</dimen>
<dimen name="text_size_button_hdpi">12dp</dimen>
<dimen name="text_size_button_xhdpi">16dp</dimen>
<dimen name="text_size_button_xxhdpi">15dp</dimen>
<dimen name="text_size_button_xxxhdpi">15dp</dimen>
The values seem to be all over the place, showing no natural progression i.e. upwards.
Yeah, they were all just trial and error, trying to get the UI to work with different previews.
What would you suggest doing?
I would recommend replacing it with the "smallestWidth" qualifier. All the qualifiers can be found here.
However, I don't think in this case all these alternative dimens are necessary. The text size for the buttons should be constant. For the bits and hex text at the top of the screen, maybe use a autoscaling TextView? I also don't believe that any of the other dimens are necessary, like TextView height, spacing etc. It may be wise to have one resource qualifier i.e. "smallestWidth" at possibly sw720dp
.
I'll close this as the solution would appear to be something else
It seemed odd to me that for the
dimens
folder you put it under the dpi resource qualifiers. I don't feel this makes sense as the dpi is independent of device size e.g. you can have a phone with greater dpi than a tablet.