相关疑难解决方法(0)

Android View.getDrawingCache返回null,仅返回null

有人请尝试向我解释原因

public void addView(View child) {
  child.setDrawingCacheEnabled(true);
  child.setWillNotCacheDrawing(false);
  child.setWillNotDraw(false);
  child.buildDrawingCache();
  if(child.getDrawingCache() == null) { //TODO Make this work!
    Log.w("View", "View child's drawing cache is null");
  }
  setImageBitmap(child.getDrawingCache()); //TODO MAKE THIS WORK!!!
}
Run Code Online (Sandbox Code Playgroud)

ALWAYS记录绘图缓存为空,并将位图设置为null?

在设置缓存之前,我是否必须实际绘制视图?

谢谢!

android android-view

94
推荐指数
3
解决办法
7万
查看次数

如何将linearlayout转换为图像

我想将layout它的内容(views)转换成Drawable图像?

android view android-linearlayout

4
推荐指数
1
解决办法
1万
查看次数