How to make SeekBar take up full width of parent

后端 未结 4 1884
野性不改
野性不改 2021-02-08 00:55

I have a SeekBar in a RelativeLayout whose width is equal to the screen width.

I applied layout_width=\"match_parent\" to the

相关标签:
4条回答
  • 2021-02-08 01:28

    Try to define following with the SeekBar in xml:

    android:padding="0dp"
    
    0 讨论(0)
  • 2021-02-08 01:30
     android:paddingStart="0dp"
     android:paddingEnd="0dp"
    

    Worked for me.

    0 讨论(0)
  • 2021-02-08 01:31

    Just solved this problem in my app. The thing is, even though you didn't set the seekBar padding, there may be some paddings(paddingLeft, paddingTop, paddingRight, paddingBottom, paddingStart, paddingEnd) in the theme your appTheme extends. Set these paddings to 0dp, it should work fine.

    0 讨论(0)
  • 2021-02-08 01:40

    Before you post your xml,I guess that your RelativeLayout has lines as following

    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    

    This means your RelativeLayout do not fill up the screen,seekbar is fill up in its parent layout(RelativeLayout).So you can not get view you want.

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