android set divider padding for preference screen

后端 未结 4 1614
清歌不尽
清歌不尽 2021-01-05 04:37

I have PreferenceScreen contain many CheckBox , i customize it by refer it to custom layout as bellow :

 
 &         


        
4条回答
  •  囚心锁ツ
    2021-01-05 05:05

    To allow preference divider padding

    first : add this line to your preference activity which lead to transparency of android default divider

    list.setDivider(new ColorDrawable(0x00000000));
    

    second : create folder named drawable in res , then create on it divider.xml which will be as below :

     
     
        
     
    

    third :

    add View to your mylayout.xml so it will be as below :

    
    
    
        
    
    
    
    
        
    
        
    
         
    
    
    
    
    
    

    the point here you add View bellow your texts and refer that view to divider shape in drawable res so finally you will get an custom divider which it can be customized as you need.

    hope that help you .

    the output will be as below:

    enter image description here

提交回复
热议问题