button01.setBackgroundColor(getResources().getColor(R.color.red));

color.xml

colors.xml

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <color name="red">#f00</color>
    <color name="green">#0f0</color>
    <color name="blue">#00f</color>
    <color name="black">#000</color>
</resources>


相关文章:

  • 2022-01-16
  • 2021-12-22
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
猜你喜欢
  • 2021-10-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-10
  • 2021-11-05
相关资源
相似解决方案