Deep copy of a Drawable

Finally I succeed! I had similar problem, when I used color filter on my drawable it changed the drawable, its very close to the solution of the other people here, but only this worked for me: Drawable drwNewCopy = dr.getConstantState().newDrawable().mutate();

How to draw text on canvas?

You will have to use the drawText method of the Canvas class. Paint paint = new Paint(); canvas.drawPaint(paint); paint.setColor(Color.BLACK); paint.setTextSize(16); canvas.drawText(“My Text”, x, y, paint); Here’s the relevant documentation about it: http://developer.android.com/reference/android/graphics/Canvas.html#drawText(java.lang.String, float, float, android.graphics.Paint)

How to set drawable size in layer-list

You can use android:width and android:height parameters with desired values. Below is the sample drawable layer-list and screen shot. I used the vector drawable from google material icons and own selector drawable. Original circle.xml drawable shape have 100dp x 100dp size, but into drawable.xml I override this values to 24dp x 24dp by android:width and … Read more

DrawableCompat tinting does not work on pre-Lollipop

When you call wrap() then the original Drawable is wrapped internally into a new DrawableWrapper which is used to implement the tinting on older devices. So to make it work you have to set the returned Drawable back to the EditText: final Drawable originalDrawable = editText.getBackground(); final Drawable wrappedDrawable = DrawableCompat.wrap(originalDrawable); DrawableCompat.setTintList(wrappedDrawable, ColorStateList.valueOf(Color.RED)); editText.setBackground(wrappedDrawable); Since … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)