作者AZHI (songs)
看板AndroidDev
标题[问题] 不透过xml档来使用google map v2
时间Sun Feb 16 19:32:51 2014
现在google map v2 不能像旧版一样放入mapView
而要在 res-->layout-->main.xml 中
放入
<fragment xmlns:android="
http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
而要加入这行
class="com.google.android.gms.maps.SupportMapFragment"
必须在xml档中,来执行google map v2
我的问题是:
在我的程式中,不透过xml档
来放入class是"com.google.android.gms.maps.SupportMapFragment"的view
请问有什麽办法吗?
(像是addView(),addContentView()?
但目前找不到什麽方法放入这个google map的class)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.205.97.16
1F:推 namejoshua:如果把 map 做成单独的 xml 档 02/17 02:50
2F:→ namejoshua:然後用 inflator 产生 view 再 addview() 可以吗? 02/17 02:51
3F:→ AZHI:谢谢N大提供的方法 但似乎只能在一般的ui上执行 02/18 19:03
4F:→ AZHI:而我忘了说我是要在Camera的画面 所以执行了还是会错误.. 02/18 19:03
5F:推 fmbase:new SupportMapFragment 02/23 08:52
推n大 最後是用n大的方法完成
只是Activity後面 需要extend FragmentActivity
※ 编辑: AZHI 来自: 123.205.97.187 (03/19 20:25)