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:
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:
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
How to Check Visibility of Software Keyboard in Android
Android "Only the Original Thread That Created a View Hierarchy Can Touch Its Views."
Detect Whether There Is an Internet Connection Available on Android
How to Make an Imageview With Rounded Corners
All Com.Android.Support Libraries Must Use the Exact Same Version Specification
Activity Has Leaked Window That Was Originally Added
Static Way to Get 'Context' in Android
Android Studio: Add Jar as Library
What Does Android:Layout_Weight Mean
How to Get a List of Installed Android Applications and Pick One to Run
How to Add a Footer in Listview
How to Pass Images (Bitmaps) Between Android Activities Using Bundles
"Failed to Load Ad: 3" With Doubleclick
Custom Adapter Getview() Method Is Not Called