Android: SeekBar with custom drawable

前端 未结 6 1186
独厮守ぢ
独厮守ぢ 2020-12-31 00:06

I have SeekBar with custom drawable. Progress element is not rendered from left side exactly but it is moved to right. How can I avoid this?



        
6条回答
  •  有刺的猬
    2020-12-31 00:28

    I can not explain why this is an issue when drawing strokes, I think it has something to do with the strokes width, but I did not yet find the source to verify.

    Fixing the Overlay

    To remove the issue at hand, you can just set an inset on your left side. A value of 1dp or 2dp both work and the seekbar will be drawn properly.

    Note: Using this approach there should be no risk that the background could be too short and not visible with low progress values, since the thumb would overlay and hide it in any case.

    
    
        
        
        
            
        
    
    

提交回复
热议问题