编程设置谷歌地图片段可见性(API2) [英] Programmatically set google map fragment visibility (API2)
本文介绍了编程设置谷歌地图片段可见性(API2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
XML:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
在常规片段它是这样的:
In regular fragment it goes like this:
mFragment = (mFragment) (getSupportFragmentManager().findFragmentById(R.id.mFragment));
mFragment.getView().setVisibility(View.INVISIBLE);
在谷歌地图片段:
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapFragment)).getMap();
但我怎么可以设置映射片段可见progrematically?
But how can I set map fragment visibility progrematically?
不能像其他人一样片段做到这一点。
Can't do it like others fragment.
推荐答案
简单:
private GoogleMap mMap;
private SupportMapFragment mMapFragment;
mMapFragment = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.mapFragment));
mMap = mMapFragment.getMap();
mMapFragment.getView().setVisibility(View.INVISIBLE);
这篇关于编程设置谷歌地图片段可见性(API2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文