Android 如何在mapview上添加文本视图
这是我的密码。 所以我在mapview上使用textview,但我希望textview周围有透明背景。。看起来应该是这样的我喜欢在地图视图上漂浮Android 如何在mapview上添加文本视图,android,textview,overlay,android-mapview,Android,Textview,Overlay,Android Mapview,这是我的密码。 所以我在mapview上使用textview,但我希望textview周围有透明背景。。看起来应该是这样的我喜欢在地图视图上漂浮 <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="7" android:orientation="vertical" android:we
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="7"
android:orientation="vertical"
android:weightSum="10">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="9"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:id="@+id/location_search"
android:drawableRight="@drawable/ic_search"
android:text="Search" />
<com.google.android.gms.maps.MapView
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:apiKey="AIzaSyD_UZKqkkSN9jQBb9vRk6P4Dz6KCTSUwzU">
</com.google.android.gms.maps.MapView>
</LinearLayout>
试试这个
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/MyTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:layout_alignParentBottom="true" />
<com.google.android.maps.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:apiKey="Your api key"
android:enabled="true"
android:clickable="true"
android:layout_above="@+id/MyTextView"" />
</RelativeLayout>
你应该做的是添加一个覆盖,而不是文本视图。你需要一个例子吗?很清楚这是一个叠加视图。使用相对布局作为父级。使用信息窗口:以下是一个示例: