我正在使用http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/comment-page-1/#comment-14326上的代码来构建自定义视图.
我想显示图像而不是通过代码绘制手.我试过设置手的纹理但没有取得任何成功.
任何人都可以让我知道如何设置图像代替手?
您可以使用BitmapShader执行此操作:
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.images);
fillBMPshader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
mPaint.setShader(fillBMPshader);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2156 次 |
| 最近记录: |