当用户点击像RED这样的特定颜色时,我正在使用以下代码来应用字体颜色.
mPaint.setColor(getResources().getColor(R.color.color2));
Run Code Online (Sandbox Code Playgroud)
而color.xml文件中的color2 是
<color name="color2">#FF3C00</color>
Run Code Online (Sandbox Code Playgroud)
现在我在应用以下颜色时遇到问题.

在我的应用程序中触摸它时使用画布绘制绘画,我想在画布上画出类似附加画面的东西.我能画它但它看起来像纯色(我的意思是完整的圆圈,但里面没有点点)
请帮我找到这个.
您可以使用BitmapShader来实现这一目标。
这是示例代码..尝试这个代码,我希望它能工作..
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.shader);
//Initialize the BitmapShader with the Bitmap object and set the texture tile mode
BitmapShader mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
fillPaint.setStyle(Paint.Style.FILL);
//Assign the 'fillBMPshader' to this paint
fillPaint.setShader(mBitmapShader);
//Draw the fill of any shape you want, using the paint object.
canvas.drawCircle(posX, posY, 100, fillPaint);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
832 次 |
| 最近记录: |