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 different devices and built a common layout to fit in all the devices. Now the only problem is on the text size.
Questions :
I would like to have your technical suggestions on how to alter the font size based on the size (the physical size) of the device.
How to derive the font size based on the aspect ratio.
Any Flaws in using this kind of approach ?
Xml for the text view
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffff" android:orientation="vertical"> <TextView android:id="@+id/tvValue4" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="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 different devices and built a common layout to fit in all the devices. Now the only problem is on the text size." android:textColor="#000000" android:textSize="15sp" /> </LinearLayout>
Thanks in advance
Select 'Display'. Select the 'Change display settings' link towards the top of the window on the left-hand side. In the 'Resolution' section, select the pull-down bar, and a slider bar should appear. Move the slider bar down to make the text larger, or move it up to make the text smaller.
Syntax: font-size-adjust: number|none|initial|inherit; Below are the examples that illustrates the use of font-size-adjust property.
Keyboard shortcutHold down the Ctrl and press the + to increase the font size or - to decrease the font size. Pressing either of these keys while continuing to hold down the control key continues to increase or decrease the font until it reaches its maximum.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With