Android button background color

后端 未结 10 1953
轮回少年
轮回少年 2020-12-08 00:25

I am trying to set the background color of a button in my app and I am unable to achieve the result that I want...

The color that I am trying to set is holo_gr

10条回答
  •  青春惊慌失措
    2020-12-08 00:43

    In addition to Mark Proctor's answer:

    If you want to keep the default styling, but have a conditional coloring on the button, just set the backgroundTint property like so:

    android:backgroundTint="@drawable/styles_mybutton"
    

    Create the associated file /res/drawable/styles_mybutton.xml, then use the following template and change the colors as per your tastes:

    
    
        
        
        
        
        
        
    
    

提交回复
热议问题