- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用这个 stackoverflow question ,我尝试将一些自定义样式应用于 Android map View 。
造型基本上就是把水弄黑
mapstyle_json.js:
[
{
featureType: 'water',
elementType: 'geometry',
stylers: [{color: '#000000'}]
},
{
featureType: 'water',
elementType: 'labels.text.fill',
stylers: [{color: '#515c6d'}]
},
{
featureType: 'water',
elementType: 'labels.text.stroke',
stylers: [{color: '#17263c'}]
}
]
我的主要 Activity :
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final MapView mapView = (MapView) findViewById(R.id.mapView);
final android.content.Context context = this;
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
googleMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN); // Without this line, the styling works as intended
try {
// Customise the styling of the base map using a JSON object defined
// in a raw resource file.
boolean success = googleMap.setMapStyle(
MapStyleOptions.loadRawResourceStyle(
context, R.raw.mapstyle_json));
if (!success) {
Log.e("1", "Style parsing failed.");
}
} catch (Resources.NotFoundException e) {
Log.e("1", "Can't find style. Error: ", e);
}
Log.d("1", "onMapReady: something");
LatLng coordinates = new LatLng(45.832119, 6.865575);
googleMap.addMarker(new MarkerOptions().position(coordinates).title("hello"));
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(coordinates, 12));
mapView.onResume();
}
});
}
}
在不设置 map 类型(使用默认 map 类型)的情况下,样式会正常工作。考虑到链接问题,应该可以设置 TERRAIN 类型 map 的样式。 (也许只使用 javascript)。
为什么这种样式没有应用于地形类型 map ?在 Android mapView 中可以吗?
编辑:
代码基于谷歌自己的指南,原始资源用例:https://developers.google.com/maps/documentation/android-sdk/styling
也许这是一个 google API v2 与 v3 的问题。据我了解,Android 使用 API v2。链接的问题是关于 v3
最佳答案
似乎是它的预期行为。来自 Official Documentation :
Styling works only on the
normal
map type.
Typical road map. Shows roads, some features built by humans, and important natural features like rivers. Road and feature labels are also visible.
关于android - google mapView 样式不适用于 maptype=TERRAIN 的 Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53820851/
我有一个包含两列的 Spark 流数据框。 Integer id 列和 MapType 列,其中 Integer Id 作为键,JSON 对象作为值。 ------------------------
我正在尝试将 Dataframe 转换为 RDD,以便将 map (带有键值对)分解为不同的行。 Info = sqlContext.read.format("csv"). \ option("del
我正在尝试从另一个 ViewController 更改 mapType,但它只显示 HybridType。无论按下分段控件上的按钮,任何其他 mapType 都不会改变。我究竟做错了什么?提前谢谢你.
我是 ios 开发的新手,在谷歌上研究了这个案例,但没有发现任何相关的东西。我正在开发一个快速的 View Controller map 。到目前为止一切顺利,在此 ViewController 中,
在我的 C++ 代码中,我通过迭代器访问 map 。如有必要,更新 map 并将其重新分配给类变量。在进行语句中,我想再次使用更新的 map 值。我应该再次加载 map ,刷新迭代器吗?等等 例如 m
我有一个 API 端点,它将 ShortGuid 类作为参数,如下所示: [HttpGet("api/endpoint")] public async Task GetTablesAsync(Shor
我在 (py)Spark 中有一个数据框,其中 1 列来自“ map ”类型。我想将那一列展平或分成多列,这些列应该添加到原始数据框中。我可以使用 flatMap 展开列,但是我松开了将新数据框(从展
继续此处的另一个讨论: MySQL + htaccess mod_rewrite? 我被要求提出另一个问题。 我将其添加到我的 httpd.conf 文件中: DBDriver mysql DBDPa
我需要在 UISegmentedControl 中保存 MapView map 类型。该代码只是将所选 map 类型保存在 UISegmentedControl 中,而不是将 map 类型保存在 Ma
我需要基于现有列创建一个新的 Spark DF MapType 列,其中列名是键,值是值。 例如 - 我有这个 DF: rdd = sc.parallelize([('123k', 1.3, 6.3,
我正在尝试使用 concat_map() 连接 Maptype 的两列。我的问题是,当我尝试连接一个 null 和一个 Map 时,当我期望获得非 Null Map 值时却得到了一个 null。 va
我一直在使用 Gheat 创建自定义热图作为 ImageMapType。我还有一些颜色编码的多边形,我想在热图创建的高光下方显示。 但是,自定义 ImageMapType 始终呈现在多边形下方,并被它
我有这个包含 3 列的数据框 -> userId, date, generation +-------+--------+---------------------------------------
我有一个带有 MapType 字段的 Dataframe。 >>> from pyspark.sql.functions import * >>> from pyspark.sql.types imp
我有一个带有 MapType 列的数据框,其中键是一个 id,值是另一个具有两个数字、一个计数器和一个收入的 StructType。 看起来像这样: +------------------------
typedef map mapType; mapType::const_iterator i; i = find_if( d.begin(), d.end(), isalnum ); 在“=”处我收到
给定如下的 DataFrame 是否可以在保持架构完整的同时过滤掉 PySpark 中 Column 集合的某些键(MapType(StringType, StringType, True))? ro
我有这样一个数据框 data = [(("ID1", {'A': 1, 'B': 2}))] df = spark.createDataFrame(data, ["ID", "Coll"]) df.s
得到一个像这样的 JS 对象: console.log(状态) Object {0: "SATELLITE", 1: "HYBRID"} 现在我需要将这两种 map 类型插入谷歌地图的选项中:
我有这样一个数据框 data = [(("ID1", {'A': 1, 'B': 2}))] df = spark.createDataFrame(data, ["ID", "Coll"]) df.s
我是一名优秀的程序员,十分优秀!