释放双眼,带上耳机,听听看~!
问题
项目中需求经常会出现Scrollview嵌套百度地图MapView,如下:
但是这样嵌套会出现Scrollview滑动的时候百度地图周边有黑边或者阴影
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
android:id="@+id/map_mapview"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_154dp"
android:clickable="true"/>
解决
将MapView换成TextureMapView即可。如下:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
android:id="@+id/map_mapview"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_154dp"
android:clickable="true"/>
原因
3.6.0版本之前由于使用系统GLSurfaceView导致由于系统问题出现的黑屏等,在新版地图SDK3.6.0中可使用TextureMapView作为地图视图控件,解决此类问题,但要求系统在4.0以上并且开启强制GPU渲染。