小编ran*_*ser的帖子

TextView(getDrawingCache)中的位图始终为null

我试图提取与显示的TextView实例关联的位图,但它总是返回一个空值.我究竟做错了什么?我应该使用textview.draw(canvas)吗?

    TextView textview = (TextView) findViewById(R.id.text_title);
    textview.setDrawingCacheEnabled(true);
    textview.buildDrawingCache();        
    Bitmap bmp = textview.getDrawingCache();
Run Code Online (Sandbox Code Playgroud)

android view

6
推荐指数
2
解决办法
7484
查看次数

标签 统计

android ×1

view ×1