不能在地图上的片段机器人添加边框 [英] can't add border on map fragment android

查看:141
本文介绍了不能在地图上的片段机器人添加边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个问题,当我尝试在片段添加边框,这似乎不工作...
这是我的XML片段,但如果我在其他布局像线性或相对布局添加,这个工作。

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"
         />

和border_bottom.xml

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> 

如何解决呢?

推荐答案

作为答案的一个例子,下面是code。包裹片段地图用的LinearLayout,并把边界线性布局。而在你的片段地图,添加保证金

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>

这篇关于不能在地图上的片段机器人添加边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆