首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >osmdroid xml文件

osmdroid xml文件
EN

Stack Overflow用户
提问于 2011-12-15 17:13:05
回答 1查看 1.2K关注 0票数 0

我做了一个使用osmdroid jar file的应用程序接口,它固定在伦敦市中心。该程序运行良好,您可以在地图上导航,但我仍然在main.xml文件中看到以下错误:

"org.osmdroid.views.MapView failed to instantiate"

有什么我应该做的吗?谢谢。

代码语言:javascript
复制
<?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>
EN

回答 1

Stack Overflow用户

发布于 2012-04-05 23:22:17

也许你自己已经找到了答案,但你不必为此担心。当我使用osmdroid的地图视图时,我的项目中也有这一点,甚至在谷歌地图上也是如此,它工作得很好。正如你在我的截图中所看到的:

不需要在org.osmdroid.views.Mapview标记中添加“xmlns:android="http://schemas.android.com/apk/res/android”“。唯一需要添加xmlns的地方是根布局项目。在这种情况下,因为它在您的LinearLayout中做得很好。在下面的代码中可以看到我的osmdroid标签的例子,它工作得很好:

代码语言:javascript
复制
<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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8517633

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档