How to add number scale inside android seekbar?

后端 未结 1 1352
暗喜
暗喜 2021-01-17 05:14

I\'m trying with the custom seekbar inside have number scale, But is not working. This seekbar must support all screen resolutions. how can i make like this. Please give you

1条回答
  •  野的像风
    2021-01-17 05:45

    There's number to solutions to the problem:

    • Use 9patch image for backgorund (which is basically should be used as background for seekbar). Like the following:

    enter image description here (name should be unselect_patch.9.png) and slightly modify custom_seekbar.xml to look like the following:

    
    
        
        
            
                
            
        
        
            
                
            
        
    
    
    

    enter image description here

    • Just provide exact size of the image in layout (e.g. layout_width="@dimen/select_image_width");

    To support all resolutions - provide images for different resolutions, as described in Supporting Multiple Screens. The same images will not work fine for all resolutions and here's better just follow best practices described in detail at the link above.

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