【问题标题】:Set a textview on top of a Map Fragment在地图片段顶部设置文本视图
【发布时间】:2013-07-02 17:24:14
【问题描述】:

我想创建此布局,但无法在片段上设置文本图像。我设置布局的要求如附图所示。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/relativeLayoutFragment"
    android:layout_width="match_parent"
    android:layout_height="fill_parent" >

     <!-- ListRow Left sied Thumbnail image -->

    <LinearLayout
        android:id="@+id/thumbnail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="5dip"
        android:background="@drawable/image_bg"
        android:padding="3dip" 
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/list_image"
            android:layout_width="50dip"
            android:layout_height="50dip"
            android:src="@drawable/atm" />
    </LinearLayout>

    <!-- Name of ATM -->

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/thumbnail"
        android:layout_toRightOf="@+id/thumbnail"
        android:textColor="#040404"
        android:textSize="15dip"
        android:textStyle="bold"
        android:typeface="sans" />

    <!-- Location -->

    <TextView
        android:id="@+id/location"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/title"
        android:layout_marginTop="1dip"
        android:layout_toRightOf="@+id/thumbnail"
        android:textColor="#343434"
        android:textSize="10dip" />


    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="fill_parent"
        android:layout_height="match_parent" />

</RelativeLayout>

【问题讨论】:

  • 贴出你试过的代码
  • @amalBit 我已经更新了代码..请检查一下
  • 检查这个答案..它涵盖了你的问题我猜. link.

标签: android google-maps


【解决方案1】:

将地图片段作为第一个(顺序很重要!)在您的RelativeLayout 中(因此它将位于“底部”)。然后(至少为了简单起见,我会这样做)将叠加层中所需的所有项目分组到另一个容器中(即LinearLayoutRelativeLayout),将该容器放在视图顶部,你就完成了。

【讨论】:

  • 很好的答案!关键是先放地图片段
  • 很好的答案。这对我帮助很大。
猜你喜欢
  • 2018-10-24
  • 2015-05-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-12
  • 1970-01-01
相关资源
最近更新 更多