android - 无法让缩放按钮显示在 MapView 上

标签 android google-maps

我已经尝试解决这个看似简单的问题大约半天了。我有一个工作的 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 方法。我发现了很多与此问题相关的帖子,但没有一个能解决它。

感谢您的帮助。

最佳答案

只有当用户点击屏幕的适当区域时,缩放控件才会出现。我不知道有什么方法可以强制它们出现,更不用说永久保留在屏幕上了。

关于android - 无法让缩放按钮显示在 MapView 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2171155/

相关文章:

javascript - 将数据从服务器发送到 js 文件.. 获取 Passport 以在 Google map 信息框上显示 Facebook 图像

Android setError ("error") 在 Textview 中不起作用

android - Twitter 登录 Quickblox

google-maps - 使用谷歌地图引擎的用户当前位置?

javascript - 在 iOS 移动浏览器中请求位置权限弹出窗口

git-remote-http.exe 运行了很长时间

android - 如何仅过滤 android Gallery 中的图像和视频?

android - NestedScrollView 内的回收器 View 导致滚动从中间开始

android - 永远不会调用 Activity 的 onBackPressed 方法

android - 即使更新了发布 key 的 SHA 1 指纹后,谷歌地图在 Play 商店发布后仍未加载