How to create the checkBox in circular shape?

后端 未结 4 1967
暗喜
暗喜 2020-12-08 16:45

I am facing the issue in creating the checkbox in circular shape in android. I tried many methods but my problem is not solved.I created the shapes and applied to the checkb

4条回答
  •  甜味超标
    2020-12-08 17:24

    After spending some time, i have created this template, which you can use. You may need to modify as required.

    In activity.xml

    
    

    create a new xml in drawable folder called custom_checkbox.xml

    
    
        
        
        
    
    

    create a new xml in drawable folder called checked.xml

    
    
        
            
                
                    
                        
                        
                        
                        
                    
                    
    
                
                    
                        
                            
                        
                    
                
    
                
                    
                        
                            
                        
                    
                
            
        
    
    
    

    create a new xml in drawable folder called unchecked.xml

    
    
            
            
            
            
        
    

    When unchecked it looks as below. (you can add the code between from checked.xml and modify the top and left to give X when checkbox is not checked)

    When checked it will look as below

    If this works mark it as answer.

提交回复
热议问题