首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Android : ForeGround of a FrameLayout (包含googleMap)中的文本

Android : ForeGround of a FrameLayout (包含googleMap)中的文本
EN

Stack Overflow用户
提问于 2015-02-20 13:01:07
回答 1查看 445关注 0票数 0

你好大家好

首先,为我糟糕的英语道歉

我首先让你就位:

我在Eclipse中为Android使用Java代码。

我的应用程序需要在一个片段中显示一个地图(Google,V2)来显示跑步者的位置。地图显示已经实现。

这是我的问题:我使用一个FrameLayout元素,它包含我的地图,因此是整个页面,但是,我的目标是在地图上显示一个以底部为中心的文本框。我尝试使用前台属性选项来设置文本,但它不起作用(当应用程序崩溃时,到达地图的页面)。

下面是我的代码fragment_carte:

代码语言:javascript
运行
复制
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/mapFrameLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:foreground="@id/txtViewCoureur"
    tools:context=".CarteFragment" >
</FrameLayout>

我不能发照片给你看我想要什么,因为这是我的第一篇文章

在问我的问题之前,我在这个论坛上尝试了许多解决方案。

谢谢你的帮助!

EN

回答 1

Stack Overflow用户

发布于 2015-02-20 13:25:16

将映射包含在RelativeLayout中,其余控件包含在FrameLayout中。下面是我有一个应用程序的例子:

代码语言:javascript
运行
复制
<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <fragment
            android:id="@+id/mapview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            class="MapFragment" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/activity_vertical_margin"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:layout_marginRight="@dimen/activity_horizontal_margin"
            android:layout_marginTop="@dimen/activity_vertical_margin" >

            <EditText
                android:id="@+id/mapsearchbox"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:alpha="0.8"
                android:background="@android:color/white"
                android:hint="@string/map_search"
                android:imeOptions="actionSearch"
                android:inputType="text"
                android:paddingLeft="@dimen/activity_horizontal_margin"
                android:paddingRight="30dp"
                android:singleLine="true"
                android:textColor="@android:color/black" >
            </EditText>

            <Button
                android:id="@+id/mapsearchbtn
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:layout_gravity="right|center_vertical"
                android:layout_margin="8dp"
                android:background="@android:drawable/ic_menu_close_clear_cancel" />
        </FrameLayout>
    </RelativeLayout>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28629616

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档