80,350
社区成员
发帖
与我相关
我的任务
分享
mShapDrawable = new ShapeDrawable(new PathShape(myPath, getWidth(), getHeight()));
Bitmap bitmap = BitmapFactory.decodeResource(this.getResources(), R.drawable.ic_launcher);
Matrix matrix = new Matrix();
Bitmap b1=Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
Shader aShader = new BitmapShader(b1, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
mShapDrawable.getPaint().setShader(aShader); //填充位图
Rect bounds = new Rect(0,0,getWidth(),getHeight());
//设置图形显示的区域
mShapDrawable.setBounds(bounds);
//绘制图形
mShapDrawable.draw(myCanvas);