在用sidemenu时,参考其demo,在fragment里开分线程:
@Override
public void takeScreenShot() {
Thread thread = new Thread() {
@Override
public void run() {
Bitmap bitmap = Bitmap.createBitmap(containerView.getWidth(),
containerView.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
containerView.draw(canvas);
ContentFragment.this.bitmap = bitmap;
}
};
thread.start();
}
这样做在刚开始并没有报错,但是在其中一个fragment里添加RecyclerView后,在
sidemenu打开时报错:Only the original thread that created a view hierarchy can touch its views,求解