Reputation: 44405
I am new to android and trying to code an app with AndroidStudio on Ubuntu 14.04. Today I relalite I have two dimens.xml and two styles.xml as follows:
Why does that happen? What have I done? What should I do now, shall I leave them as it is, or should I adjust it?
To clarify: I did not create those files, I cannot reconstruct when they popped up first.
Also, those files do not seem to exist in the directory values
, but there are directories values-21
and values-w820dp
, probably created in last October already!
I am - again - completely confused by android and I appreciate help to clarify what is going on....
Upvotes: 1
Views: 299
Reputation: 67259
Those files likely existed when you first created the application, as they are generated by default when you create a new Android Studio project.
The reason you are seeing them grouped together is that Android Studio has an "Android" view that groups resources together so you can find them more easily. If you want the project pane to display a more accurate reflection of the structure of these files on your disk, click "Android" at the top of the project pane and switch to the "project" view.
As for what these are- Android allows you to define alternate resources for different device configurations.
Note that the second dimens.xml
file has (w820dp) next to it- this means that it will be used for devices with a screen width of 820dp or larger. Similarly, the second styles.xml
file has a qualifier (v21) that means it is only used on devices running API level 21 or higher.
Upvotes: 5
Reputation: 17142
The values-21
directory holds resource files that are only applied to API >= 21 devices, where values-w820dp
contains resource files that are only applied to devices whose width is >= 820dp (This is useful in case you wanted to specify the minimum width required by a certain layout)
These divisions give you the ability to apply different styles & use different dimensions per API level (or range).
Upvotes: 2