我们想在谷歌地图上显示我们的矢量瓦片,我们已经使用谷歌地图 SDK 的瓦片提供程序完成了 png 瓦片,但我们需要矢量瓦片 GeoJson。我找到了一些这样的解决方案 :
这里有这些代码:
public class GoogleMapsActivity extends FragmentActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
final Context context = this;
return super.onOptionsItemSelected(item);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.DarkTheme);
if(SettingsActivity.mUnits){
setContentView(R.layout.google_maps_tracker_metric);
} else {
setContentView(R.layout.google_maps_tracker);
}
}
@Override
protected void onResume(){
super.onResume();
// Get both fragments shown on the same screen
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
GoogleMapsTracker fragment;
fragment = GoogleMapsTracker.newInstance();
GoogleMapsOGLES fragmentOGL;
fragmentOGL = GoogleMapsOGLES.newInstance();
fragmentTransaction.add(R.id.map, fragment);
fragmentTransaction.add(R.id.gl, fragmentOGL);
fragmentTransaction.commit();
}
@Override
protected void onPause(){
super.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
但这并不完整,并且有一些未提供的布局和类。有人这样做或可以帮助我吗?