android add map with transparent buttons on top programmatically -
i want add @ run time map , transparent(as in map visible underneath) buttons controll type of map shows(normal/satellite/traffic).
i can xml like
<relativelayout ...> <map> <button .../> <button .../> </relativelayout> however since want select api key based on debug/release can't map go "under" buttons, here try
this.mapview = new mymapview(this, map_key); this.mapview.setclickable(true); relativelayout.layoutparams p = new relativelayout.layoutparams(relativelayout.layoutparams.fill_parent, relativelayout.layoutparams.match_parent); //p.addrule(relativelayout.below, r.id.tipo_mappa); p.addrule(relativelayout.center_in_parent); this.mapview.setlayoutparams( p ); layout.addview(this.mapview, 0); the result see map in fullscreen, buttons hidden/underneath maybe.
this layout.xml
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayoutmappa" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <!-- <com.google.android.maps.mapview android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignparentbottom="true" android:apikey="abc" android:clickable="true" /> --> <radiogroup android:id="@+id/tipo_mappa" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:orientation="horizontal" > <radiobutton android:id="@+id/normal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="@string/mappa_normale" /> <radiobutton android:id="@+id/sat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="8dp" android:text="@string/mappa_satelite" /> </radiogroup> <checkbox android:id="@+id/traffic" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_torightof="@+id/tipo_mappa" android:onclick="myclickhandler" android:text="@string/mappe_traffic" /> </relativelayout>
not sure if it'll work, try requesting focus buttons after adding map. might pull them surface. view.requestfocus()
Comments
Post a Comment