Different Values Folders in Android

Different values folders in android

The approach you are using is a valid approach, but a little outdated. From HoneyComb, there is a new way to fix all of this. Your resources folder should now look like this:

Sample Image

Please refer to the link I have posted and familiarize yourself with Smallest Width concept.

Hope this helps :)

EDIT: Adding to this post, try to establish some kind of standardization in your dimens.xml, something like this:

Sample Image

Doing this makes it easier to maintain code, plus it reduces the number of dimen folders. Normally rather than having values-hdpi, values-xhdpi, etc. files like values-sw480dp-xhdpi might have more values to adjust, but then again all of this is contextual.

Setting different resource values using values folder for different API versions

For android API's other than v23, shouldn't android read the "hardwareAcceleratedValue" value from res/values/bool.xml?

-v23 is used for API Level 23 and higher.

How can I just set "hardwareAcceleratedValue" to false only for Android-M or less and true for all versions beyond android-M?

Have false in res/values/bool.xml and true in res/values-v22/bool.xml. Android M is API Level 21, so -v22 will be used for all higher versions.

If by "android-M" you mean Android 5.x, then have false in res/values/bool.xml and true in res/values-v23/bool.xml, as Android 5.1 was API Level 22.

Values folders for specific android versions

No. Only create a /values/ and a /values-v21/ folder for your styles. This will be used by Android 5 and below and Android 6 and above.

If both folders exist with proper Styles.xml files, then Android 6 devices will use values-v21 and Android 5 and below devices will use values



Related Topics



Leave a reply



Submit