title: Is there a simpler/better way to put a border/outline around my TextView?
body: <p>So I wanted to have a TextView with a cool border around it. I couldn't find any standard way of doing it, so I came up with this:</p>
  
  <p>@drawable/custom_bg_1: A blue rounded shape</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;solid android:color="#439CC8"/&gt;
      &lt;corners android:radius="3dp" /&gt;
      &lt;padding android:left="10dp" android:top="10dp"
          android:right="10dp" android:bottom="10dp" /&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>@drawable/custom_bg_2: A white rounded shape</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;solid android:color="#FFFFFF"/&gt;
      &lt;corners android:radius="3dp" /&gt;
      &lt;padding android:left="10dp" android:top="10dp"
          android:right="10dp" android:bottom="10dp" /&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>myactivity.xml: the xml for the activity</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:padding="15dp" &gt;
  
    &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:padding="2dp"
      android:background="@drawable/custom_bg_1" &gt;
  
        &lt;TextView android:layout_width="fill_parent"
              android:layout_height="wrap_content"
          android:text="@string/curr_loc"
          android:textSize="15sp"
          android:background="@drawable/custom_bg_2" /&gt;
  
    &lt;/LinearLayout&gt;
  &lt;/Linearlayout&gt;
  </code></pre>
  
  <p>The outcome:</p>
  
  <p><img src="https://i.stack.imgur.com/0iQSB.jpg" alt="picture of blue border"></p>
  
  <p>What I am doing here is overlapping a white shape background inside a blue shape background to give the effect of a blue border. I can't imagine this is the best way to get this effect. I have seen other posts that attempt to solve this problem such as <a href="https://stackoverflow.com/questions/2026873/android-way-to-appear-bordered-text-on-the-textview">this</a> and <a href="https://stackoverflow.com/questions/3496269/how-to-put-a-border-around-an-android-textview">this</a>, but I feel like they are just as much of a work around as my implementation.</p>
  
  <p>Is there a better way or more standard way of simply putting a border around certain views such as a TextView or should I just stick with the way I am doing it?</p>
  
  <hr>
  
  <p><b>EDIT</b></p>
  
  <p>I changed custom_bg_2.xml to look like this:</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;solid android:color="#FFFFFF"/&gt;
      &lt;stroke android:width="2dp" android:color="#000000"/&gt;
      &lt;corners android:radius="3dp" /&gt;
      &lt;padding android:left="10dp" android:top="10dp"
          android:right="10dp" android:bottom="10dp" /&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>And now I get this result:</p>
  
  <p><img src="https://i.stack.imgur.com/c9VZD.jpg" alt="blue and black border"></p>
  
  <p>It looks like I can achieve an outline by including <code>&lt;stroke ... /&gt;</code> in shape.</p>