Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何使用表情符号拍摄旋转文本视图的屏幕截图?_Android_Bitmap_Textview_Screenshot_Emoji - Fatal编程技术网

Android 如何使用表情符号拍摄旋转文本视图的屏幕截图?

Android 如何使用表情符号拍摄旋转文本视图的屏幕截图?,android,bitmap,textview,screenshot,emoji,Android,Bitmap,Textview,Screenshot,Emoji,我正在尝试制作一个包含表情符号的旋转文本视图的屏幕截图。但在生成的位图上,我看到表情符号没有旋转!为什么会这样?如何使用旋转表情符号制作屏幕截图 我所期望的是: 这就是我得到的: 我正在使用此方法获取视图的屏幕截图: layout.setDrawingCacheEnabled(true); layout.buildDrawingCache(); Bitmap bitmap = null; if (layout.getDrawingCache() != null) bitmap = l

我正在尝试制作一个包含表情符号的旋转文本视图的屏幕截图。但在生成的位图上,我看到表情符号没有旋转!为什么会这样?如何使用旋转表情符号制作屏幕截图

我所期望的是:

这就是我得到的:

我正在使用此方法获取视图的屏幕截图:

layout.setDrawingCacheEnabled(true);
layout.buildDrawingCache();
Bitmap bitmap = null;
if (layout.getDrawingCache() != null)
    bitmap = layout.getDrawingCache().copy(Bitmap.Config.ARGB_8888, false);
layout.setDrawingCacheEnabled(false);
layout.destroyDrawingCache();
更新:
如我所想,如果我设置
textView.setLayerType(View.LAYER\u TYPE\u SOFTWARE,null)
那么表情符号即使在TextView中也不会旋转(如果你旋转TextView-它们不会旋转,它们会像旋转木马一样四处移动),但我仍然不明白为什么会发生这种情况,或者表情符号的旋转(在第一张图片上)仅仅是因为硬件加速

好吧,我找不到办法解决这个非常烦人的问题,所以我不得不稍微解决一下。 ImageView可以完美地进行旋转。 因此,我基本上使用图像视图进行所有操作,并使用以下方法将其图像设置为表情文字之外的图像:

private Bitmap generateBitmapFromText(int size, String res) {
    TextView tv = new TextView(getContext());
    tv.setText(res);
    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, 150f);
    tv.setTextColor(0xffffffff);
    tv.measure(size, size);
    int questionWidth = tv.getMeasuredWidth();
    int questionHeight = tv.getMeasuredHeight();
    Bitmap bitmap = Bitmap.createBitmap(questionWidth, questionHeight, Bitmap.Config.ARGB_8888);
    Canvas c = new Canvas(bitmap);
    tv.layout(0, 0, questionWidth, questionHeight);
    tv.draw(c);
    return bitmap;
}
然后我打电话

    Bitmap bitmap = generateBitmapFromText(stickersStartingSize, res);
    imageview.setImageBitmap(bitmap);

请发布您的xml。没有xml,视图已创建并添加到上的“RelativeLayout”runtime@AlexanderAgeichenko你知道吗?@gbhall不,这个问题仍然存在open@AlexanderAgeichenko我也有同样的问题。