I planned to use different font size for the textview on different device size so as to make the letters legible. I have already decided not to use different layouts for dif
For font sizes use scale pixels (sp). Android will scale the font size accordingly depending on the device density. Above posts have a better explanation and the reasoning.
Yes, this approach is flawed. Android devices have different sizes, but they can also have very different densities as well.
You should just be following the Android design best practices.
They're actually very well thought out. Why would you want to reinvent the wheel?
Try this, Add this attribute in your xml. It will adjust textsize based on screensize try it.
style="@android:style/TextAppearance.DeviceDefault.Medium"
String s= "hello";
TextView tv= (TextView) findViewById(R.id.tv);
Spannable span = new SpannableString(s);
span.setSpan(new RelativeSizeSpan(5f), 0, span.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
tv.setText(span);
Based on screen size change 5f to whatever you want.
http://developer.android.com/guide/practices/screens_support.html. Check the topic under heading Best Practices.
for this issue I am using following library in so many projects and believe this is fantastic. No need to worry about screens. But again you need to create separate layouts for tabs.
https://github.com/intuit/sdp
For API 26 and higher
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
android:autoSizeTextType="uniform" />
Source:https://developer.android.com/guide/topics/ui/look-and-feel/autosizing-textview