我做了一个使用osmdroid jar file的应用程序接口,它固定在伦敦市中心。该程序运行良好,您可以在地图上导航,但我仍然在main.xml文件中看到以下错误:
"org.osmdroid.views.MapView failed to instantiate"
有什么我应该做的吗?谢谢。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<org.osmdroid.views.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/mapview">
</org.osmdroid.views.MapView>
</LinearLayout>发布于 2012-04-05 23:22:17
也许你自己已经找到了答案,但你不必为此担心。当我使用osmdroid的地图视图时,我的项目中也有这一点,甚至在谷歌地图上也是如此,它工作得很好。正如你在我的截图中所看到的:

不需要在org.osmdroid.views.Mapview标记中添加“xmlns:android="http://schemas.android.com/apk/res/android”“。唯一需要添加xmlns的地方是根布局项目。在这种情况下,因为它在您的LinearLayout中做得很好。在下面的代码中可以看到我的osmdroid标签的例子,它工作得很好:
<org.osmdroid.views.MapView
android:id="@+id/osmMV"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_margin="20dip"
android:layout_weight="1"
android:clickable="true" />祝你有一个好的发展!
Kr
https://stackoverflow.com/questions/8517633
复制相似问题