如果我使用@Override protected void onDraw(Canvas canvas) {
//just some gray color background
Drawable background = getResources().getDrawable(R.color.light_gray, null);
//this is a balloon in nine patch
Drawable drawable = getDrawable();
//the result of this is white in balloon, black outside of the balloon.
drawDirectlyOnCanvas(canvas, background, drawable);
//this produces the expected result
drawWithBitmap(canvas, background, drawable);
}
private void drawWithBitmap(Canvas passInCanvas, Drawable dest, Drawable src) {
Bitmap bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
dest.setBounds(0, 0, getWidth(), getHeight());
dest.draw(canvas);
((NinePatchDrawable)src).getPaint().setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
src.draw(canvas);
passInCanvas.drawBitmap(bitmap, 0, 0, null);
}
private void drawDirectlyOnCanvas(Canvas passInCavas, Drawable dest, Drawable src) {
dest.draw(passInCavas);
((NinePatchDrawable)src).getPaint().setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
src.draw(passInCavas);
}
语法在cassandra中创建一个列,并在该列中插入JSON字符串。它会保留一组唯一的JSON字符串吗?我的意思是,如果我输入2个相同的JSON字符串,它是否只在列中存储一个版本。
答案 0 :(得分:0)
是
例如:
INSERT INTO用户(user_id,first_name,last_name,收藏夹) 价值观('史密斯','威尔','史密斯',{'猫','猫'});
将导致
史密斯, “{ '猫'}”,威尔史密斯
希望它有所帮助!