I have created different layouts (layout, layout-small, layout-normal, layout-large, layout-xlarge) and for values (values, values-ldpi, values-mdpi, values-n
layouts (layout, layout-small, layout-normal, layout-large, layout-xlarge)
values (values, values-ldpi, values-mdpi, values-n
Use this code, it works based on screen size:
Display display = getWindowManager().getDefaultDisplay(); int displayWidth = display.getWidth(); yourTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,(float)(displayWidth * 6/100));