Colorは、色を扱うクラス・・・。
今回はJava側で、Buttonの背景色として、Colorクラスに定義された赤緑青の定数(int)をセットする・・・。
activity_main.xmlで、
Buttonを3つ配置・・・。
strings.xmlには"Button1"~"Button3"を定義・・・。
MainActivity.javaでは、
findViewByIdでButtonオブジェクトを取得したら、setBackgroundColorにColorに定義された色定数をセット・・・。
(setBackgroundColorの引数もintなのでColorに定義された定数を受け取れる・・・。)
こんな感じで背景に色が付く・・・。
Sample/android/Color/Color/src/Color at master · bg1bgst333/Sample · GitHub