The area of camera is transparent.
I have search similar questions in stackoverflow,and found some answers,but all of these not suit my situation.
Hers is a question I found:How to programmatically take a screenshot in Android?
I have a custom view(CameraView) which can display what the camera grabs.But when I use the way above to screenshot,I found that the area CameraView is transparent,but this is what I do not want.
There is the picture I using phone to screenshot.For to display well I add black background to the ImageView's parent.
Before Screenshot:http://paradisehell.org/img/bug/before_screenshot.jpg
After Screenshot:http://paradisehell.org/img/bug/after_screenshot.jpg
Here is my code:
View view = ((Activity)mContext).getWindow().getDecorView().getRootView();
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache());
view.setDrawingCacheEnabled(false);
if (bitmap != null && listener != null){
listener.onScreenShot(bitmap);
}
public void onScreenShot(Bitmap shot) {
Log.e("TAG", CameraViewUtils.getBase64StringFromBitmap(shot));
imageView.setImageBitmap(shot);
}
Do you have some ideas to solve it?Please tell me,there thanks.