title: Setting background drawable to a TextView is not working
body: <p>I've looked it up everywhere on StackOverflow and can't seem to find an answer to my question. I am running an API v.16 device, and the background-updating method for a TextView which uses Drawable as its background, is provided below. Everything else works--the TextViews change their textSize and height/width successfully, in the unmentioned here part of the total code. Any ideas on what might be the problem? The app doesn't stop, there is just no change in the thickness of the stroke. In fact, the TextView looses its background in the change altogether. It's original background is a corner-smoothed rectangle of a certain stroke width, which should halve in size, as well as its stroke width. After the change no background is getting displayed in the TextView altogether.</p>
  
  <pre><code>if (textViewsArrayList.size() != 0) textViews.get(textViewsArrayList.size() - 1).post(new Runnable() {
  
          @Override
          public void run() {
  
              for (counter = 0; counter &lt; textViewsArrayList.size(); counter++) {
  
                  textViewsArrayList.get(counter).getLayoutParams().height = (int)               
                  (textViewsArrayList.get(counter).getLayoutParams().height / 2);
  
                  textViewsArrayList.get(counter).getLayoutParams().width = (int) (textViewsArrayList.get(counter).getLayoutParams().width / 2);
                  ((TextView) textViewsArrayList.get(counter)).setTextSize(TypedValue.COMPLEX_UNIT_PX, (int) (((TextView) textViewsArrayList.get(counter)).getTextSize() / 2));
  
                  GradientDrawable background = (GradientDrawable) textViewsArrayList.get(counter).getBackground();
  
                  background.setStroke((int) (4 / displayMetrics.density / 2), (int) Color.parseColor("#FFA500"));;
  
                  if (android.os.Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.JELLY_BEAN) {
  
                      ((TextView) textViewsArrayList.get(counter)).setBackground((Drawable) background);
  
                  } else {
  
                      ((TextView) textViewsArrayList.get(counter)).setBackgroundDrawable((Drawable) background);
  
                  }
  
              }
  
          }
  
  });
  </code></pre>
  
  <p>While the xml for the TextView in question is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/layout"
      android:layout_width="320dp"
      android:layout_height="90dp"
      android:tag="layout"&gt;
      &lt;TextView
          android:id="@+id/textview"
          android:layout_height="68dp"
          android:layout_width="match_parent"
          android:background="@drawable/drawable_xml"
          android:layout_marginLeft="6dp"
          android:layout_marginRight="6dp"
          android:layout_marginTop="7dp"
          android:tag="textview_in question"/&gt;
  
  etc.
  </code></pre>
  
  <p>As for the drawable xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;stroke
          android:width="4dp"
          android:color="#FF6600" /&gt;
  
      &lt;corners
          android:bottomRightRadius="10dp"
          android:bottomLeftRadius="10dp"
          android:topLeftRadius="10dp"
          android:topRightRadius="10dp"/&gt;
  
      &lt;solid android:color="#FFFFFF" /&gt;
  
  &lt;/shape&gt; 
  </code></pre>