android-无法获取缩放按钮以在MapView上显示
作者:互联网
我已经尝试解决这个看似简单的问题了大约半天.我有一个工作的MapView,我只想显示默认的缩放键,并一直将它们放在那里.它们根本不会出现-不是因为它们出现然后消失了.
码:
public void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
setContentView( R.layout.main );
_altDisplay = (TextView) findViewById( R.id.altitudeDisplay );
_speedDisplay = (TextView) findViewById( R.id.speedDisplay );
_accuracyDisplay = (TextView) findViewById( R.id.accuracyDisplay );
_mapView = (MapView) findViewById( R.id.mapView );
_mapView.setBuiltInZoomControls(true);
_mapController = _mapView.getController();
_mapController.setZoom(22);
_locationUpdates = new LocationUpdateHandler( (LocationManager) getSystemService( Context.LOCATION_SERVICE) );
_locationUpdates.addObserver( this );
}
public void updateLocation( GeoPoint point, double altitude, float speed, float accuracy )
{
_mapController.setCenter(point);
_altDisplay.setText( "Altitude: " + Double.toString(altitude) );
_speedDisplay.setText( "Speed: " + Float.toString(speed) );
_accuracyDisplay.setText( "Accuracy: " + Float.toString(accuracy) );
}
我尝试注释掉setZoom,并尝试将setBuiltInZoom控件移至updateLocation方法.我发现了很多与此问题相关的帖子,但都没有解决该问题的帖子.
谢谢你的帮助.
解决方法:
仅当用户点击屏幕的适当区域时,缩放控件才会出现.我不知道一种强制它们出现的方法,更不用说将它们永久留在屏幕上了.
标签:google-maps,android 来源: https://codeday.me/bug/20191210/2100724.html