The method setBuiltInZoomControls(boolean) is undefined for the type MapView
程序员文章站
2022-07-15 13:25:17
...
package com.googlemaps;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import com.google.android.gms.maps.MapView;
import com.google.android.maps.MapActivity;
public class MainActivity extends MapActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView view= (MapView) findViewById(R.id.map);
view.setBuiltInZoomControls(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
Activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"
/>
解决方案:
由于我的项目在创建时的“Project Build Target"选项指定成了“Android"而没有指定为“Googlg APIs"造成的,改过来之后就解决了!
要新建一个target是googleAPI的模拟器
上一篇: No mapping found for HTTP request with URI [/HelloWeb/] in DispatcherServlet with name 'HelloWeb...
下一篇: No mapping found for HTTP request with URI [/app17a/] in DispatcherServlet with name 'springmvc'解决方法
推荐阅读
-
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory
-
The method setBuiltInZoomControls(boolean) is undefined for the type MapView
-
The method getDispatcherType() is undefined for the type HttpServletRequest
-
The method getJspApplicationContext(ServletContext) is undefined for the type Js
-
The method getJspApplicationContext(ServletContext) is undefined for the type
-
The method getServletContext is undefined for the type HttpServletRequest
-
android开发:The method getSupportFragmentManager() is undefined for the type
-
The method getJspApplicationContext(ServletContext) is undefined for the type Js
-
The method getJspApplicationContext(ServletContext) is undefined for the type Js