title: How to create android shape background programmatically?
body: <p>How to create this shape programmatically?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
      android:padding="10dp"
      android:shape="rectangle"&gt;
  
      &lt;solid android:color="#e67e22"/&gt; 
      &lt;corners
          android:topLeftRadius="0dp"
          android:topRightRadius="0dp"
          android:bottomLeftRadius="5dp"
          android:bottomRightRadius="5dp"/&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>I've tried this simple function which gets corners, colors and sets that to shape:</p>
  
  <pre><code>    LinearLayout linearLayout = (LinearLayout) findViewById(R.id.category_header);
  
      GradientDrawable drawable = (GradientDrawable) linearLayout.getDrawable();
  
      float[] values = { 0.2f, 0.2f, 0.2f, 0.2f };
      drawable.setCornerRadii(values);
  </code></pre>
  
  <p>But I got this error: </p>
  
  <p><strong>The method getDrawable() is undefined for the type LinearLayout</strong></p>