小编Zai*_*idi的帖子

如何将标记添加到MapView

基本上我正在使用mapview在我的应用程序中显示地图。意味着不像大多数地图应用程序那样使用片段。但是我面临在地图上添加标记的问题。请帮我。

这是我的编码

private static final int GPS_ERROR_DIALOG_REQUEST = 9001;
MapView mMapView;
GoogleMap map;
Context CTX = this;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (servicesOK()) {
        setContentView(R.layout.parents);
        mMapView = (MapView) findViewById(R.id.map);
        mMapView.onCreate(savedInstanceState);
        Toast.makeText(this, "Ready to map!", Toast.LENGTH_SHORT).show();
        map.addMarker(new MarkerOptions()
                .position(new LatLng( 4.588946, 101.125293))
                .title("You are here"));
    }
    else
    {
        Toast.makeText(this, "Not ready to map!", Toast.LENGTH_SHORT).show();
    }

    Button AddUser = (Button) findViewById(R.id.user_reg);
    Button KidsDelete = (Button) findViewById(R.id.user_del);

    AddUser.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Parents.this, AddUser.class));
        } …
Run Code Online (Sandbox Code Playgroud)

android google-maps marker

1
推荐指数
1
解决办法
4551
查看次数

标签 统计

android ×1

google-maps ×1

marker ×1