Android - How to programmatically set button color

后端 未结 3 800
深忆病人
深忆病人 2020-12-16 18:54

I am reading in some data from a REST api and need to generate some buttons based on the information the app receives.

Because I need the same buttons in many Activi

3条回答
  •  时光说笑
    2020-12-16 19:35

    You should do:

    setTextColor(getContext().getResources().getColor(R.color.info_button_text_color));
    

提交回复
热议问题