gpt4 book ai didi

android - 如何获取源和目的地的经纬度?

转载 作者:行者123 更新时间:2023-11-30 04:32:05 26 4
gpt4 key购买 nike

大家好,当我们输入位置地址时如何实现获取纬度和经度的代码(我的意思是当我从地址输入到自动完成 Textview 时。然后我将从地址和到地址获取纬度和经度).so 帮我解决问题。

最佳答案

您正在寻找反向地理编码概念。这里有很好的解释。

http://mobiforge.com/developing/story/using-google-maps-android

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<com.google.android.maps.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0l4sCTTyRmXTNo7k8DREHvEaLar2UmHGwnhZVHQ"
/>

</RelativeLayout>



import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.MapView.LayoutParams;

import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

public class MapsActivity extends MapActivity
{
MapView mapView;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);


mapView = (MapView) findViewById(R.id.mapView);
LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
View zoomView = mapView.getZoomControls();

zoomLayout.addView(zoomView,
new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
mapView.displayZoomControls(true);

}

@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}

关于android - 如何获取源和目的地的经纬度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7526240/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com