Android 修改谷歌地图水印
我在滚动视图中有一个谷歌地图地图视图。它工作得很好,除了滚动时,我会在底部和顶部看到一些难看的黑色背景 以下是该问题的视频: 为了解决这个问题,我将地图包装在一个框架布局中,使它比实际的容器大,这解决了这个问题,但现在我再也看不到谷歌水印了。我试着使用底部填充物,但填充物的黑色图案再次出现,但这次只在底部 在FrameLayout中使用谷歌地图水印的字体和样式放置文本视图可以作为解决方案吗?如果我这样做,是否违反了TOS 这是我的修复程序的xml:Android 修改谷歌地图水印,android,google-maps,google-maps-android-api-2,Android,Google Maps,Google Maps Android Api 2,我在滚动视图中有一个谷歌地图地图视图。它工作得很好,除了滚动时,我会在底部和顶部看到一些难看的黑色背景 以下是该问题的视频: 为了解决这个问题,我将地图包装在一个框架布局中,使它比实际的容器大,这解决了这个问题,但现在我再也看不到谷歌水印了。我试着使用底部填充物,但填充物的黑色图案再次出现,但这次只在底部 在FrameLayout中使用谷歌地图水印的字体和样式放置文本视图可以作为解决方案吗?如果我这样做,是否违反了TOS 这是我的修复程序的xml: <FrameLayout an
<FrameLayout
android:id="@+id/map_view_container"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_below="@+id/location"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/full_margin"
android:background="@color/transparent">
<com.google.android.gms.maps.MapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_gravity="center"
android:background="@color/off_white"
map:mapType="normal" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent" />
</FrameLayout>
你能展示地图活动/片段吗?
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_business_home, container, false);
final Bundle mapViewSavedInstanceState = savedInstanceState != null ? savedInstanceState.getBundle("mapViewSaveState") : null;
initializeViewComponents(rootView, mapViewSavedInstanceState);
return rootView;
}
private void initializeViewComponents(View rootView, Bundle savedInstanceState) {
scrollView = (ScrollView) rootView.findViewById(R.id.scroll_view);
mapView = (MapView) rootView.findViewById(R.id.map_view);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
MapsInitializer.initialize(this.getActivity());
this.map = googleMap;
// Gets to GoogleMap from the MapView and does initialization stuff
map.getUiSettings().setMyLocationButtonEnabled(true);
map.getUiSettings().setAllGesturesEnabled(false);
map.setMyLocationEnabled(true);
onAsyncLoad();
}
@Override
public void onResume() {
if (mapView != null) {
mapView.onResume();
}
super.onResume();
}
@Override
public void onLowMemory() {
if (mapView != null) {
mapView.onLowMemory();
}
super.onLowMemory();
}
public void onSaveInstanceState(Bundle outState) {
Log.i(TAG, "SAVING TO INSTANCE STATE");
//This MUST be done before saving any base class variables
final Bundle mapViewSaveState = new Bundle(outState);
if (mapView != null) { // May be null after onDestroView
mapView.onSaveInstanceState(mapViewSaveState);
outState.putBundle("mapViewSaveState", mapViewSaveState);
}
}