来自scrollview可见区域的Android Bitmap

时间:2015-07-07 20:59:04

标签: android bitmap scrollview

我有一个静态辅助方法,它接受View并返回View的Bitmap。 (真正的方法在返回之前修改位图)。

public static Bitmap getBitmapFromView(View targetView) {
    Bitmap bitmap =
            Bitmap.createBitmap(
                targetView.getWidth(), 
                targetView.getHeight(), 
                Bitmap.Config.ARGB_8888);

    Canvas canvas = new Canvas(bitmap);
    targetView.draw(canvas);

    ....

    return bitmap;
}

我想修改一个特殊情况,当targetView是ScrollView时。我想只抓取可见的ScrollView部分,而不是整个ScrollView。我似乎无法想出任何例子。

1 个答案:

答案 0 :(得分:0)

SelectList phonetypes = ViewBag.PhoneType; <div> <label class="label-fixed-width">Phone:</label> @Html.TextBoxFor(x => x.Phone[0].Phone, null, new { style = "width: 600px" }) @Html.DropDownListFor(x => x.Phone[0].PhoneType, phonetypes,"--------", new { @class = "form-control-inline dropdown", style = "width: 100px" }) 上调用getDrawingCache()可能是一种可能的解决方案:

targetView