Android: Creating a Circular TextView?

后端 未结 11 1598
我在风中等你
我在风中等你 2020-12-04 08:53

My current simple XML is below, however i would like the 3 TextViews within it to be circular, rather than rectangular.

How can I change my code to do so?

         


        
11条回答
  •  死守一世寂寞
    2020-12-04 09:59

    Create an texview_design.xml file and populate it with the following code. Put it in res/drawable.

    
    
            
    
            
    
            
    
        
    

    Then in your main XML file just add the following line for each TextView:

      android:background="@drawable/texview_design"
    

    Second way (not recommended): circle Download this circle and place it in your drawable folder and then make it your TextView's background. and then set the gravity to center.

    Then it will look like this:

    enter image description here

提交回复
热议问题