tint

Lollipop's backgroundTint has no effect on a Button

心已入冬 提交于 2019-11-26 03:50:35
I have a Button in my Activity, and I'd like it to have my theme's accent color. Instead of making my own drawables like we had to do pre-Lollipop, naturally I'd like to use the new backgroundTint attribute. <Button android:id="@+id/btnAddCode" android:layout_width="match_parent" android:layout_height="wrap_content" android:backgroundTint="@color/accent" android:text="@string/addressInfo_edit_addCode" /> Unfortunately it has no effect, the button stays gray. I tried different values for backgroundTintMode , which didn't change anything. I also tried doing it programmatically in my Activity,

How to set tint for an image view programmatically in android?

纵然是瞬间 提交于 2019-11-26 02:16:32
问题 Need to set tint for an image view... I am using it the following way: imageView.setColorFilter(R.color.blue,android.graphics.PorterDuff.Mode.MULTIPLY); But it doesn\'t change... 回答1: You can change the tint, quite easily in code via: imageView.setColorFilter(Color.argb(255, 255, 255, 255)); // White Tint If you want color tint then imageView.setColorFilter(ContextCompat.getColor(context, R.color.COLOR_YOUR_COLOR), android.graphics.PorterDuff.Mode.MULTIPLY); For Vector Drawable imageView

Lollipop&#39;s backgroundTint has no effect on a Button

自作多情 提交于 2019-11-26 01:14:47
问题 I have a Button in my Activity, and I\'d like it to have my theme\'s accent color. Instead of making my own drawables like we had to do pre-Lollipop, naturally I\'d like to use the new backgroundTint attribute. <Button android:id=\"@+id/btnAddCode\" android:layout_width=\"match_parent\" android:layout_height=\"wrap_content\" android:backgroundTint=\"@color/accent\" android:text=\"@string/addressInfo_edit_addCode\" /> Unfortunately it has no effect, the button stays gray. I tried different