How to overlay text on the android map view
I have an application to show the MapView having both height and width fill_parent. I need to overlay some text on the top part of the Map View. How to do this?. The background of 开发者_如何学JAVAtext should be transparent. Also the text has the property of marquee. Is it possible to do this?
Use a RelativeLayout as the root container of you layout and add the MapView and a TextView to it (below the MapView in the layout xml file). Use the TextView to display the text which should be displayed above the map. Now you can use the attributes starting withlayout_
to place the TextView where you want it.
As far as I know, the marquee effect only works when the TextView is focused and its text value is too long to fit in the whole TextView.
The TextView's background should be transparent by default.
Create a RelativeLayout as the container of your Mapview and a TextView
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<MapView .../>
<TextView /> </RelativeLayout>
You can display the TextView where you want with the RelativeLayout child attributes, for example on the textView : layout_alignParentBottom="true"
Otherwise just use an itermized overlay to put the text in.
精彩评论