<com.zhy.android.percent.support.PercentRelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" app:layout_marginTopPercent="8%h" > <ImageView android:id="@+id/image_temp" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/icon_map" android:visibility="gone"/> <com.baidu.mapapi.map.MapView android:layout_below="@id/prl_top" android:id="@+id/mMapView" android:layout_width="match_parent" android:layout_height="match_parent"> </com.baidu.mapapi.map.MapView> </com.zhy.android.percent.support.PercentRelativeLayout>
slidingMenu和百度地图在切换的时候会出现黑边的现象,查了百度地图官方也没有找到好的解决办法,网上都是使用截图的方式来解决,我用了一下效果并不是很好,就用了一种投机取巧的办法
//打开的时候显示一张图片并隐藏map slidingMenu.setOnOpenListener(new SlidingMenu.OnOpenListener() { @Override public void onOpen() { Log.d("map", "slidingMenu is opening---"); image_temp.setVisibility(View.VISIBLE); mMapView.setVisibility(View.GONE); } }); //关闭以后再还原回来 slidingMenu.setOnClosedListener(new SlidingMenu.OnClosedListener() { @Override public void onClosed() { Log.d("map","slidingMenu is closed"); image_temp.setVisibility(View.GONE); mMapView.setVisibility(View.VISIBLE); } }); }image_temp是我找的一张百度地图的图片,当侧边栏出来的时候就让这张图片显示,侧边栏消失的时候就让百度地图出来,虽然效果也不是很好,但是比黑边好多了