Today iam try to solve Text size in all Android Devices, last one week am struggle to solve this issue finally found the solution of this issue.
STEP : 1
first in ` res` folder => values => dimensions.xml=> create `dimensions.xml` file to `values folder` in that create like below code depending on textsize
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="textsize">8sp</dimen>
<dimen name="text">10sp</dimen>
<dimen name="comments">7sp</dimen>
</resources>
STEP : 2
in java file write this line
TextView textviewtwo = (TextView)findViewById(R.id.sponsertwo_txt);
textviewtwo.setText("brought to you by");
textviewtwo.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.textsize));
// in place of textsize use text and comments what ever we want depending on size. use like text size adjust automatically in all devices
STEP : 1
first in ` res` folder => values => dimensions.xml=> create `dimensions.xml` file to `values folder` in that create like below code depending on textsize
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="textsize">8sp</dimen>
<dimen name="text">10sp</dimen>
<dimen name="comments">7sp</dimen>
</resources>
STEP : 2
in java file write this line
TextView textviewtwo = (TextView)findViewById(R.id.sponsertwo_txt);
textviewtwo.setText("brought to you by");
textviewtwo.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.textsize));
// in place of textsize use text and comments what ever we want depending on size. use like text size adjust automatically in all devices
1 comment:
Thanks :)
Post a Comment