I have made a new value resource file in the android studio project as name dimens but while referring to it from XML I have to use the attribute @dimen
I am really curious to know the referring tag must have to be the same as the file name but it is not.
I have seen the same pattern in strings and colors.
But it is like that? any clue?
CodePudding user response:
name of your files doesn't matter in fact, you can rename dimens.xml
to anything.xml
. Or you can have dimen_activity.xml
and dimen_fragment.xml
files, which helps you manage them. Also, you can keep in this file <dimen
tags, but also <integer
s and any other (e.g. you can have one sizes.xml
file). Resources are built upon content inside all XML files placed in values
, a kind-of map is created then and all <dimen
s from all XML files are available under @dimen/
or R.dimen.