Text alignment issue when changing font / text size
I have looked through quite a few answers and questions here on stackoverflow but didn't find anything helpful in my problem.
I have two text images of the same size and equal properties next to each other, the xml layout is this (only the text is different)
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:id="@+id/data_content_left"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".50"
android:gravity="bottom|center"
android:text="201.5"
android:textSize="50sp"
android:textStyle="bold"
android:singleLine="true"
android:ems="62" />
<TextView
android:id="@+id/data_content_right"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.50"
android:ems="62"
android:gravity="center|bottom"
android:singleLine="true"
android:text="201.5"
android:textSize="20sp"
android:textStyle="bold" />
and the code is
package com.example.fonttest; import android.os.Bundle; import android.app.Activity; import android.graphics.Typeface; import android.view.Menu; import android.widget.LinearLayout; import android.widget.TextView;
public class MainActivity extends activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textViewLeft = (TextView) findViewById(R.id.data_content_left);
TextView textViewRight = (TextView) findViewById(R.id.data_content_right);
Typeface myTypeface = Typeface.createFromAsset(this.getAssets(), "fonts/wwDigital.ttf");
textViewLeft.setTypeface(myTypeface, Typeface.NORMAL);
textViewRight.setTypeface(myTypeface, Typeface.NORMAL);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Why does the height of the "white space" under the numbers change with the text / font size? (see below)
How do I determine if the issue is with the font or the text view?
I am using this font: [ http://www.dafont.com/ww-digital.font containing [3 ]
source to share