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"/>
在常规 fragment 中是这样的:
mFragment = (mFragment) (getSupportFragmentManager().findFragmentById(R.id.mFragment));
mFragment.getView().setVisibility(View.INVISIBLE);
在谷歌地图 fragment 中:
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapFragment)).getMap();
但我怎样才能逐步设置 map fragment 的可见性?
不能像其他 fragment 那样做。
最佳答案
就这么简单:
private GoogleMap mMap;
private SupportMapFragment mMapFragment;
mMapFragment = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.mapFragment));
mMap = mMapFragment.getMap();
mMapFragment.getView().setVisibility(View.INVISIBLE);
关于android - 以编程方式设置谷歌地图 fragment 可见性(API2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13833709/