-1

I want to have a dimens.xml file, where I keep dimensions that I use in my Android Studio main_activity.xml file, but I can't find it in app->res->values.

Are we supposed to create that file on our own? If yes, how to do it? I tried to search for similar questions, but didn't find any. Please help!

Maksym
  • 9
  • 1
  • 3

1 Answers1

1

Ok, I think I found a way to do it. Basically, in app->res->value right-click your mouse, and select: ->New->Values resource file. Filename is whatever you want (I used "dimen") as long as you refer by the same name later, and click "OK". That file is created and you can store your dimensions inside "resources" pair of tags.

The format is the following:

<dimen name="dimension_name">dimension</dimen>

where dimension_name and dimension are parameters set by you.

Later on, to use them in your XML you type @your_file_name/dimension_name

where your_file_name and dimension_name were chosen by you, earlier.

Maksym
  • 9
  • 1
  • 3