how to make android seekbar full width in api 17 or above?

三世轮回 提交于 2020-01-03 15:59:52

问题


I want to make seekbar full width with no padding.

I've seen this answer How to make SeekBar take up full width of parent

but in api 17 and above it doesn't work. there is a padding in left and right of seekbar. how do i remove this padding?


回答1:


I just set padding at run time and it's OK now!

musicSeekbar.setPadding(0,0,0,0);



回答2:


You can make it work using XML (API 17+):

android:paddingStart="0dp"
android:paddingEnd="0dp"



回答3:


you can use a parent layout before your seekbar's layout and put your seekbar layout in another one so that you can fill_parent



来源:https://stackoverflow.com/questions/33327246/how-to-make-android-seekbar-full-width-in-api-17-or-above

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!