title: Spannable text in TextView not showing properly
body: <p>I had this code working fine, but when updating the build tools and libraries from 26.0.2 to 27.0.3, the TextViews started to cut the text. There are 4 TextViews in a LinearLayout. Each TextView has a width 0dp and a weight of 1. All TextViews have a 4 letters word so they are supposed to show identically, however that build tools update ruined it. </p>
  
  <pre><code>        String s = "ssss";
          float textBigger = 1.5f;
          SpannableString ss1 = new SpannableString(s);
          int index = 2;
          ss1.setSpan(new RelativeSizeSpan(textBigger), 0, index, 0); // set size
          ss1.setSpan(new ForegroundColorSpan(biggerTextColor), 0, index, 0);// set color
          textView.setText(ss1, TextView.BufferType.SPANNABLE);
  </code></pre>
  
  <p>How it is supposed to look:
  <a href="https://i.stack.imgur.com/ojADX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ojADX.png" alt="enter image description here"></a></p>
  
  <p>How it is now looking:
  <a href="https://i.stack.imgur.com/0W1eB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0W1eB.png" alt="enter image description here"></a></p>
  
  <p>Libraries updated from 26.0.2:</p>
  
  <pre><code>compile 'com.android.support:appcompat-v7:27.0.2'
  compile 'com.android.support:design:27.0.2'
  compile 'com.android.support:cardview-v7:27.0.2'
  compile 'com.android.support:support-v4:27.0.2'
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>After more debugging, I changed back my gradle to have the following:</p>
  
  <pre><code>compileSdkVersion 27
  buildToolsVersion = '27.0.3'
  targetSdkVersion 23
  compile 'com.android.support:appcompat-v7:26.0.2'
  </code></pre>
  
  <p>Now by just changing targetSdkVersion to 27, the problem arises. The spannable thing has nothing to do with it. The text in the TextViews is behaving differently. It is even showing in the AndroidStudio xml preview that the text is cut when the targetSdkVersion is set to 27.</p>
  
  <p>To test it out, create a project with the gradle settings above. And the below MainActivity layout. Change targetSdkVersion from 23 to 27 and you should see the problem.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context="com.example.ziadalhalabi.testspannable.MainActivity"&gt;
  
  
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:gravity="center"&gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_margin="8dp"
              android:layout_weight="1"
              android:background="?attr/selectableItemBackgroundBorderless"
              android:ellipsize="end"
              android:fontFamily="sans-serif-light"
              android:gravity="center"
              android:maxLines="1"
              android:text="Amin"
              android:textSize="18sp" /&gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_margin="8dp"
              android:layout_weight="1"
              android:background="?attr/selectableItemBackgroundBorderless"
              android:ellipsize="end"
              android:fontFamily="sans-serif-light"
              android:gravity="center"
              android:maxLines="1"
              android:text="Bmin"
              android:textSize="18sp" /&gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_margin="8dp"
              android:layout_weight="1"
              android:background="?attr/selectableItemBackgroundBorderless"
              android:ellipsize="end"
              android:fontFamily="sans-serif-light"
              android:gravity="center"
              android:maxLines="1"
              android:text="Cmaj"
              android:textSize="18sp" /&gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_margin="8dp"
              android:layout_weight="1"
              android:background="?attr/selectableItemBackgroundBorderless"
              android:fontFamily="sans-serif-light"
              android:gravity="center"
              android:maxLines="1"
              android:text="Dmin"
              android:textSize="18sp" /&gt;
  
      &lt;/LinearLayout&gt;
  
  
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:gravity="center"&gt;
  
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_margin="8dp"
              android:layout_weight="1"
              android:background="?attr/selectableItemBackgroundBorderless"
              android:fontFamily="sans-serif-light"
              android:gravity="center"
              android:maxLines="1"
              android:text="Gmaj"
              android:textSize="18sp" /&gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_margin="8dp"
              android:layout_weight="1"
              android:background="?attr/selectableItemBackgroundBorderless"
              android:fontFamily="sans-serif-light"
              android:gravity="center"
              android:maxLines="1"
              android:text="C#min"
              android:textSize="18sp" /&gt;
  
          &lt;TextView
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_margin="8dp"
              android:layout_weight="1"
              android:background="?attr/selectableItemBackgroundBorderless"
              android:fontFamily="sans-serif-light"
              android:gravity="center"
              android:maxLines="1"
              android:text="F#min"
              android:textSize="18sp" /&gt;
  
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>