Note that there are some explanatory texts on larger screens.

plurals
  1. POTextview alignment issue when changing font/text size
    primarykey
    data
    text
    <p>I have looked through quite a few answers and questions here on stackoverflow but have not found anything really helpful regarding my problem. </p> <p>I have two textviews of equal size and equal properties right next to each other, the xml layout is this (only textsize differ)</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; </code></pre> <p></p> <pre><code> &lt;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" /&gt; &lt;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" /&gt; </code></pre> <p></p> <p>and the code is this</p> <p>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;</p> <p>public class MainActivity extends Activity {</p> <pre><code>@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; } </code></pre> <p>}</p> <p>Why is the height of the 'white space' below the numbers changing with text/font size? (se image below)</p> <p>How can I determine if the problem has something to do with the font or with the textview?</p> <p>I'm using this font: [<a href="http://www.dafont.com/ww-digital.font][3]" rel="nofollow noreferrer">http://www.dafont.com/ww-digital.font][3]</a></p> <p><img src="https://i.stack.imgur.com/fo4oD.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload