你好大家好
首先,为我糟糕的英语道歉
我首先让你就位:
我在Eclipse中为Android使用Java代码。
我的应用程序需要在一个片段中显示一个地图(Google,V2)来显示跑步者的位置。地图显示已经实现。
这是我的问题:我使用一个FrameLayout元素,它包含我的地图,因此是整个页面,但是,我的目标是在地图上显示一个以底部为中心的文本框。我尝试使用前台属性选项来设置文本,但它不起作用(当应用程序崩溃时,到达地图的页面)。
下面是我的代码fragment_carte:
<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>我不能发照片给你看我想要什么,因为这是我的第一篇文章
在问我的问题之前,我在这个论坛上尝试了许多解决方案。
谢谢你的帮助!
发布于 2015-02-20 13:25:16
将映射包含在RelativeLayout中,其余控件包含在FrameLayout中。下面是我有一个应用程序的例子:
<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>https://stackoverflow.com/questions/28629616
复制相似问题