title: Android applying border around SurfaceView
body: <p>I have one <code>SurfaceView</code> for which I want to display a border of <code>20dp</code> size which will flow around the <code>SurfaceView</code>. I need 'SurfaceView' in <code>16:9</code> aspect ratio, so i kept the size of the <code>SurfaceView</code> to <code>161x286</code> which is in <code>16:9</code> ratio. </p>
  
  <p>To display border around the surface view i have following implementation in XML. </p>
  
  <pre><code>&lt;RelativeLayout 
      android:id="@+id/my_surface_view_holder"
      android:layout_height="161dp"
      android:layout_width="286dp"
      android:padding="20dp"
      android:focusable="true"
      android:clickable="true"
      android:background="#fff"
      &gt;
      &lt;SurfaceView 
          android:id="@+id/video_surface_view"
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Above code displays the border around the <code>SurfaceView</code> properly but it breaks the 16:9 aspect ration of the video as i have given padding of <code>20dp</code> for displaying border.</p>
  
  <p>If i adjust aspect ration according to the border size then border is not evenly set, on top/bottom it is different and on left/right it is different. </p>
  
  <p>So How can i display the border around SurfaceView by keeping it's aspect ration maintained to size 161x286.</p>
  
  <p>Thanks.</p>