4
到剪贴板我有以下代码:添加PNG在android系统
File imageFile = new File(f.getAbsolutePath());
ContentValues values = new ContentValues(2);
values.put(MediaStore.Images.Media.MIME_TYPE, "image/png");
values.put(MediaStore.Images.Media.DATA,imageFile.getAbsolutePath());
ContentResolver theContent = getContentResolver();
Uri imageUri = theContent.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
ClipData theClip = ClipData.newUri(getContentResolver(),"image", imageUri);
android.content.ClipboardManager clipboard = (android.content.ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setPrimaryClip(theClip);
我只看到clipboard
不是image
本身,我认为它必须能够看到image
因为当你把一个路径您可以在剪贴板中看到图片。如果你知道如何将位图传递给剪贴板,请告诉,也许它只有一个位图。 如果有人能提出解决方案,我会非常感谢。
是你的问题解决了。我有同样的问题。你有没有解决这个问题,粘贴路径而不是图像。 –