回答編集履歴
1
MenuItemの場合について追記
answer
CHANGED
@@ -16,4 +16,23 @@
|
|
16
16
|
|
17
17
|
// alphaの設定
|
18
18
|
imageView.setAlpha(0.8f);
|
19
|
+
```
|
20
|
+
|
21
|
+
---
|
22
|
+
|
23
|
+
**追記: MenuItemの場合**
|
24
|
+
|
25
|
+
MenuItemの場合は呼び出すメソッドやxmlの属性名を以下のように変更してください。
|
26
|
+
|
27
|
+
```xml
|
28
|
+
<item
|
29
|
+
...
|
30
|
+
app:iconTint="@color/xxx"
|
31
|
+
/>
|
32
|
+
```
|
33
|
+
|
34
|
+
```java
|
35
|
+
item.setIcon(R.drawable.xxx);
|
36
|
+
int color = ContextCompat.getColor(context, R.color.xxx);
|
37
|
+
MenuItemCompat.setIconTintList(item, ColorStateList.valueOf(color));
|
19
38
|
```
|