gpt4 book ai didi

Android 获取完整的 View as Bitmap

转载 作者:行者123 更新时间:2023-11-29 00:43:51 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Android 2.1 View's getDrawingCache() method always returns null

我有一个要保存位图的布局。

如果我的布局小于屏幕,一切都很好。但是如果我的布局更大,位图 (b) 为空。

这是我的代码:

layout.setDrawingCacheEnabled(true);

int wt = layout.getMeasuredWidth();
int ht = layout.getMeasuredHeight();
layout.layout(0, 0, wt, ht);

Bitmap b = layout.getDrawingCache(true);

那么我怎样才能将整个 View 作为位图呢?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com