To explain - here is an example.
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
myButton.setTextSize((float)metrics.widthPixels / 10f);
Problem is, on Galaxy J5 and most other phones I've tested, the resulting text size is correct - 1/10th of the width of the screen. On Galaxy A5 and Huawei P9 Lite it is not (it's larger). What could be the problem? Am I missing something?