先说明 我遇到的情况:
在对当前屏幕进行截图的时候 ,截到的图片总是 有部分空白,先看布局
需要对其截屏的 activity:
在 对上图进行截图分享的时候 发现 截取图片的 柱状图是 空白的:
解决办法:
给布局中的 WebView 设置 android:layerType="software" 属性;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<WebView
android:id="@+id/web_market_information_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layerType="software" />
</RelativeLayout>
添加 android:layerType="software" 之后的截图能正常显示 柱状图了:
原因参考:http://blog.csdn.net/u011730649/article/details/43937003
android:layerType
属性参考:http://blog.csdn.net/a345017062/article/details/7478667