Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is another easy option that you can use which meets your requirements.</p> <ul> <li><p>Create new drawable resource with defined shape. Call this resource (XML file): <em>margin_border.xml</em> and place it under drawable folder. The content of this XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" &gt; &lt;stroke android:width="50dp" android:color="#800ff4ff" /&gt; &lt;solid android:color="#00000000" /&gt; &lt;/shape&gt; </code></pre> <p><strong>Explanation:</strong> This shape will act as border/frame for your inner layout. The 'stroke' attribute which is a border could be in any color you want and the 'solid' attribute has transparent color.</p></li> <li><p>Then use this shape in your main layout:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;com.google.android.maps.MapView android:id="@+id/MapView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:apiKey="..." android:clickable="true" android:enabled="true" /&gt; &lt;!-- Set hollow layout --&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:background="@drawable/margin_border" android:padding="50dp" &gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p><strong>Explanation:</strong> The main layout is RelativeLayout. The MapView didn't change, except alignParent flag for all directions which is set to true like it's shown here.</p> <p>And finally use any layout you want for the center. I used LinearLayout while background is referencing to shape drawable. </p> <p>Note: The padding of this layout must be the same as the stroke width in the shape. In this case it is 50dp</p></li> </ul> <p>This is how it looks on my mobile (screenshot):</p> <p><img src="https://i.stack.imgur.com/PhlhF.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload