title: android - How to set corner radius programmatically?
body: <p>I have two <code>ListViews</code> (leftList, rightList). I also have one <code>TextView</code> which I use as row view in both of them. 
  I have a rectangle drawable shape and set it as background to the <code>TextView</code>.</p>
  
  <p>I would like to change this shape and have rounded corners on the left.</p>
  
  <p>What I tried :</p>
  
  <pre><code>       GradientDrawable gradientDrawable = new GradientDrawable();
         // gradientDrawable.setCornerRadius(30);
          ((GradientDrawable)gradientDrawable.mutate()).setCornerRadius(30);
  
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.JELLY_BEAN) {
              viewHolderPattern.digits.setBackground(gradientDrawable);
          }
  </code></pre>
  
  <p>I have created a new layout in drawable with the right corner radius set and set that to the textView with <code>setBackgroundRescource</code> but still didn't work.</p>
  
  <p><strong>The TextView that I use as items in both listViews</strong></p>
  
  <pre><code>&lt;TextView
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/digitsTextView"
      android:textSize="15dp"
      android:paddingTop="7dp"
      android:paddingBottom="8dp"
      android:fontFamily="monospace"
      android:textColor="@color/selected_items"
      android:background="@drawable/digital_text_shape"&gt;
  &lt;/TextView&gt;
  </code></pre>
  
  <p><strong>Shape layout digital_text_shape.xml</strong></p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
      android:shape="rectangle"&gt;
      &lt;stroke
          android:width="1dp"
          android:color="@color/orange" /&gt;
      &lt;solid android:color="@color/orange" /&gt;
      &lt;corners
          android:bottomLeftRadius="20dp"
          android:bottomRightRadius="0dp"
          android:topLeftRadius="20dp"
          android:topRightRadius="0dp"
          /&gt;
      &lt;padding
          android:bottom="0dp"
          android:left="20dp"
          android:right="0dp"
          android:top="0dp" /&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p><strong>Left list and Right list</strong></p>
  
  <pre><code>&lt;!-- Left ListView --&gt;
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
                      &gt;
                          &lt;ListView
                              android:layout_width="match_parent"
                              android:layout_height="match_parent"
                              android:layout_gravity="center_horizontal"
                              android:id="@+id/left_listView"
                              android:divider="@android:color/transparent"
                              android:dividerHeight="0.1sp"
                              android:choiceMode="singleChoice"
  
                              &gt;
                          &lt;/ListView&gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;!-- Right ListView --&gt;
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
                      &gt;
                          &lt;ListView
                              android:id="@+id/right_listView"
                              android:layout_width="match_parent"
                              android:layout_height="match_parent"
                              android:divider="@android:color/transparent"
                              android:dividerHeight="0.1sp"
                              android:choiceMode="singleChoice"
                              &gt;
                          &lt;/ListView&gt;
                  &lt;/LinearLayout&gt;
  </code></pre>