簡體   English   中英

Google Map Library 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM