Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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
You can use the following:
float yourDimen = getResources().getDimension(R.dimen.your_dimen_name);
Add a comment
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);
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.