我已经使用了Osmdroid教程,如下所示在地图视图上显示指南针叠加层,但是问题是它没有显示指南针。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
map = findViewById(R.id.map);
map.setTileSource(TileSourceFactory.MAPNIK);
setView(12, new GeoPoint(35.68, 51.38));
/* compass part */
CompassOverlay comOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(getApplicationContext()), map);
comOverlay.enableCompass();
map.getOverlays().add(comOverlay);
}