I have looked through quite a few answers and questions here on stackoverflow but have not found anything really helpful regarding my problem.
I have two textviews of equal size and equal properties right next to each other, the xml layout is this (only textsize differ)
<?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 this
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 is the height of the 'white space' below the numbers changing with text/font size? (se image below)
How can I determine if the problem has something to do with the font or with the textview?
I'm using this font: [http://www.dafont.com/ww-digital.font][3]

Use the same font ie ttf for both text view and use android:ems in Textview to define max and min value of it.
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