项目场景:
android 高德地图 出现 Attempt to read from field 'android.view.Surface android.view.ViewRootImpl.m。。。
问题描述:
将高德地图嵌入到fragment,然后切换页面时一直出现Attempt to read from field 'android.view.Surface android.view.ViewRootImpl.m。。。报错却正常运行。。。。
原因分析:
我经过多次debug,发现时 高德的问题。。。。开玩笑哈哈哈
解决方案:
在对应的xml文件中
<com.amap.api.maps.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
将MapView 改成TextureMapView即可,即改成如下
<com.amap.api.maps.TextureMapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
解决高德地图Fragment嵌入问题
本文介绍了解决在Android应用中将高德地图嵌入到Fragment时遇到的读取Surface错误的方法。通过将MapView替换为TextureMapView,可以有效避免此问题。
6019

被折叠的 条评论
为什么被折叠?



