![](/img/trans.png)
[英]Error inflating class fragment - sherlockactionbar google map v2
[英]Google Map library V2 glitches in inflating it at Run time
我有一個xml名稱layout.xml。 我的問題是如何在運行時給它充氣?
LayoutInflater mInflater=(LayoutInflater)HomeActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = mInflater.inflate(R.layout.fake,null, false);
maplayout.addView(view);
由於視圖沒有“ findFragmentById”,地圖用來像這樣初始化
map=((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
請幫忙 !!
layout.xml
<fragment
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
我需要在運行時給它充氣
你不可以。 歡迎您使用FragmentTransaction
在運行時將片段動態添加到UI中 。
您可以通過調用GoogleMap map = getMap();
使它不膨脹GoogleMap map = getMap();
在onCreateView
的片段中
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.