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);