更改Android-Seekbar的大小?

han*_*nes 8 android seekbar

我有关于搜索栏的问题.我尝试了几件事,但没有任何帮助.我想更改搜索栏的高度,但不是完整的搜索栏,只有用拇指滚动的栏.我尝试了几个例子,例如setBackGroundDrawable和setProgressDrawable,并制作了我自己的drawables,但drawable-size固定为Standard-Android-Seekbar的大小.我现在能做什么?

flo*_*pes 47

您必须在所有方向上添加一些填充,而不是设置最小和最大高度.以下是我使用的一个示例:

<?xml version="1.0" encoding="utf-8"?>
<SeekBar xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:progressDrawable="@drawable/custom_player_seekbar_background"
        android:paddingTop="10px" 
        android:paddingBottom="10px" 
        android:thumb="@drawable/bt_do_player" 
        android:paddingLeft="30px" 
        android:paddingRight="30px" 
        android:minHeight="6dip"
        android:maxHeight="6dip" 
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"/>
Run Code Online (Sandbox Code Playgroud)

  • 请注意,Android建议使用`dp`而不是'px`. (15认同)
  • 它的作品,但我不明白原因,因为"向所有方向添加填充"的大小变化.谢谢. (2认同)