How to resize text on android according to screen

148 views Asked by At

I am working on android application in which i want to set my text size according to the screen. I am using the following method, but it is not re-sizing my text size according to the screen.

myRequestText.setTextSize(convertFromDp(21));//myRequestText is a textview
public float convertFromDp(int input) {
        final float scale = getResources().getDisplayMetrics().density;
        return ((input - 0.5f) / scale);
    }
0

There are 0 answers