mapView = (MapView) findViewById(R.id.mapview); XmlPullParser parser=getResources().getXml(R.xml.attrs); AttributeSet attrs = Xml.asAttributeSet(parser); mapView = new MapView(this, attrs);
而且, attrs.xml 文件应该在 res/xml/ ,不是 res/values/ 。
attrs.xml
res/xml/
res/values/