Changing button style in the whole application

后端 未结 2 1423
天涯浪人
天涯浪人 2021-01-04 19:17

I\'m trying to change all the TextColor of my buttons in my app to white and also trying to make it bold. But that isn\'t happening, I\'m overwriting the android:Widge

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-04 19:58

    For styling your Button you can use this:

    Go to the drawable folder and make an XML (e.g. button.xml) file called "style" which contains the following:

     
    
      
    
        
             
                 
                   
                           
                  
               
        
    
    
    

    This is my code, you can make the necessary changes you want

    Now call it in your layout XML (mainactivity.xml) like this

    android:background="@drawable/button.xml"
    

    Now to change the font color and style you can use the following which comes as part of the styles.xml in the values folder

    
    

    Now call this in the layout XML (mainactivity.xml) like this

      style="@style/buttonStyle"
    

    The final code is:

    Hope this helps :)

提交回复
热议问题