android - Show MapFragment in a DialogFragment -
i'm new android development , i'm working on app need use google map select event position , need show map popup windows , see post :
i have same problem listed on post did not understand how
her did :
xml layout
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".addeventactivity" > <scrollview android:id="@+id/scrollview1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignparentleft="true" > <linearlayout android:layout_width="match_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="15dp" > <textview android:id="@+id/textview6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="address :" /> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <imagebutton android:id="@+id/map_button" android:layout_width="45dp" android:layout_height="45dp" android:adjustviewbounds="false" android:padding="3dp" android:scaletype="centerinside" android:src="@drawable/map_icon" /> <edittext android:id="@+id/adress" android:layout_width="fill_parent" android:layout_height="wrap_content" android:ems="10" > </edittext> </linearlayout> <framelayout android:id="@+android:id/realtabcontent" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" > <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="280dp" class="com.google.android.gms.maps.supportmapfragment" /> </framelayout> </linearlayout> </scrollview>
on click button :
map_butt.setonclicklistener(new view.onclicklistener() { @suppresslint("newapi") @override public void onclick(view v) { // todo auto-generated method stub window window = getwindow(); window.setflags( windowmanager.layoutparams.flag_not_touch_modal, windowmanager.layoutparams.flag_not_touch_modal); window.clearflags(windowmanager.layoutparams.flag_dim_behind); windowmanager.layoutparams wmlp = window.getattributes(); wmlp.y -= 10; window.setattributes(wmlp); gm = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map)).getmap(); marker = gm.addmarker(new markeroptions().title("vous ĂȘtes ici").position(new latlng(0, 0))); } });
thanks help
Comments
Post a Comment