对于MapFragment子集GoogleMapOptions [英] Set GoogleMapOptions for the MapFragment subclass

查看:275
本文介绍了对于MapFragment子集GoogleMapOptions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一种方法

MapFragment.newInstance(options)

问题是,我有我自己的CustomMapFragment这是MapFragment的子类,我不知道我怎么能对一个子类设置GoogleMapOptions。

The problem is that I have my own CustomMapFragment which is subclass of MapFragment and I don't see how I can set GoogleMapOptions for a subclass.

我需要这个设置

options.zOrderOnTop(真);

options.zOrderOnTop(true);

有什么办法来设置地图选项,而无需创建一个新的片段或也许我可以改变Z顺序不知何故别的吗?

Is there any way to set map options without creating a new fragment or maybe I can change Z-order somehow else?

推荐答案

所以正确的方法是寻找Android源$ C ​​$ C内。此后,我想出了这个方法:

So the correct solution was to look inside Android source code. After this I came up with this method:

public static CustomMapFragment newInstance(GoogleMapOptions options) {
     CustomMapFragment f = new CustomMapFragment();
     Bundle args = new Bundle();
     args.putParcelable(MAP_OPTIONS, options);
     f.setArguments(args);
     return f;
}

这篇关于对于MapFragment子集GoogleMapOptions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆