How do you render text in an android layer-list xml file?

前端 未结 1 647
耶瑟儿~
耶瑟儿~ 2020-12-31 10:08

I would like to add text to a layer-list xml file that is used as a drawable background for a Switch element. The problem is the text in the switch element changes before th

1条回答
  •  感动是毒
    2020-12-31 10:24

    With the new api21 you can use VectorDrawables to do something like you want. Here is an example:

    
    
        
            
                
                
            
        
        
    
    

    That will use a drawable vector like the following:

    
    
        
    
    

    This will generate a list-layer drawable like the following:

    Most image tools (gimp, photoshop, illustrator, etc.) give you the ability to export the path that can be used for the vector graphic.

    Checkout the gist at github!

    0 讨论(0)
提交回复
热议问题