答案 0 :(得分:1)
正如Shankar所写,您可以通过Google Maps Styles:
执行此操作在没有Equator设置的raw
文件夹JSON文件(例如map_style.json
)中创建(有关详细信息,请参阅this问题和答案):
map_style.json
:
[
{
"featureType": "administrative",
"elementType": "geometry.fill",
"stylers": [{ "visibility": "off" }]
}
]
然后将其应用于onMapReady()
回调:
public class MainActivity extends AppCompatActivity implements OnMapReadyCallback {
private static final String TAG = MainActivity.class.getSimpleName();
private GoogleMap mGoogleMap;
private MapFragment mapFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapFragment = (MapFragment) getFragmentManager()
.findFragmentById(R.id.map_fragment);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
try {
// Customise the styling of the base map using a JSON object defined
// in a raw resource file.
boolean success = mGoogleMap.setMapStyle(
MapStyleOptions.loadRawResourceStyle(
this, R.raw.map_style));
if (!success) {
Log.e(TAG, "Style parsing failed.");
}
} catch (Resources.NotFoundException e) {
Log.e(TAG, "Can't find style. Error: ", e);
}
}
}
你会得到类似的东西:
答案 1 :(得分:0)
您必须将elementType设置为几何。请参阅这些官方docs和此媒体post。
您可以使用
关注特定位置div {
padding: 40px;
}
.color-class {
position: relative;
}
.color-class:before {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgb(255, 0, 0);
opacity: 1;
z-index:-1;
}
.lighten:before {
opacity: 0.5;
}