0

I get an issue when I try to add border on fragment, this seems not to work ... This is my fragment xml, but if I added on other layout like Linear or Relative Layout, this works..

<fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:layout_below="@+id/include1"
        android:background="@drawable/border_bottom"
         />

and border_bottom.xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item> 
    <shape android:shape="rectangle">
      <solid android:color="#FF0000" /> 
    </shape>
  </item>   
    <item android:bottom="5dp" >  
     <shape android:shape="rectangle"> 
      <solid android:color="#000000" />
    </shape>
   </item>    
 </layer-list> 

How do I fix it ?

tckmn
  • 52,184
  • 22
  • 101
  • 145
bukanamay
  • 577
  • 5
  • 11
  • 26

1 Answers1

1

As an example of the answer, below is the code. Wrap the fragment map with a linearlayout, and put the border in the linear layout. And in your fragment map, add margin

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/border_bottom" >
    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_margin="2dp"
        android:layout_height="120dp"
        android:layout_below="@+id/include1"
        android:background="@drawable/border_bottom"
     />
</LinearLayout>
Elye
  • 30,821
  • 26
  • 115
  • 272