回答編集履歴
1
MenuItemの場合について追記
test
CHANGED
@@ -35,3 +35,41 @@
|
|
35
35
|
imageView.setAlpha(0.8f);
|
36
36
|
|
37
37
|
```
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
---
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
**追記: MenuItemの場合**
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
MenuItemの場合は呼び出すメソッドやxmlの属性名を以下のように変更してください。
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
```xml
|
54
|
+
|
55
|
+
<item
|
56
|
+
|
57
|
+
...
|
58
|
+
|
59
|
+
app:iconTint="@color/xxx"
|
60
|
+
|
61
|
+
/>
|
62
|
+
|
63
|
+
```
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
```java
|
68
|
+
|
69
|
+
item.setIcon(R.drawable.xxx);
|
70
|
+
|
71
|
+
int color = ContextCompat.getColor(context, R.color.xxx);
|
72
|
+
|
73
|
+
MenuItemCompat.setIconTintList(item, ColorStateList.valueOf(color));
|
74
|
+
|
75
|
+
```
|