Reputation: 613
I am using dimen.xml for supporting multiple screen sizes.
How can I access the file and get the dimen from code so can be used in the application?
Yoav
Upvotes: 4
Views: 4399
Reputation: 15701
yes just create different values folder with different qualifiers like res/values-320x480/ , you can use as mention in this link and link2
Resources res = getResources();
float fontSize = res.getDimension(R.dimen.font_size);
Upvotes: 3
Reputation: 67502
You can use the following:
float yourDimen = getResources().getDimension(R.dimen.your_dimen_name);
Upvotes: 11