Activate a specific size of the dimension.xml at runtime

I need to select a specific diameter.xml at runtime after my application checks the screen capabilities. I DO NOT WANT ANDROID TO CHOOSE IT FOR ME by automatically selecting the project folder (\ values, \ values-large, ...).

I need to do this manually due to the poor screen configuration (density and dimensionality) of my inexpensive Chinese tablet. Can I do it?

0
source share
2 answers

It was decided to use styles / themes / ... and activate a specific theme at runtime in onCreate (), as described here:

android dynamically changes style at runtime

0
source

Have you tried to force a configuration change?

DisplayMetrics metrics = new DisplayMetrics(); metrics.densityDpi = DisplayMetrics.DENSITY_MEDIUM; metrics.setTo(metrics); 

Not sure if it works. It is generally a bad idea to ignore what the OS thinks is the best.

0
source

Source: https://habr.com/ru/post/917441/


All Articles