我SeekBar在我的应用程序中使用了一个,我想稍微定制一下.我已经想出了如何改变Drawable拇指和背景.
我的问题是如何改变大小SeekBar?如果我只是改变SeekBar like this, theView is only clipped and it only shows the top piece of theSeekBar` 的高度:
<SeekBar
android:layout_height="10dip"
style="@style/seekbar_style" />
Run Code Online (Sandbox Code Playgroud)
如何更改整体尺寸Seekbar?我希望它比标准更薄SeekBar.
Sep*_*phy 23
您确实拥有与seekbar相同的Progress Bar:
<style name="Widget.SeekBar">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@android:drawable/progress_horizontal</item>
<item name="android:indeterminateDrawable">@android:drawable/progress_horizontal</item>
<item name="android:minHeight">20dip</item>
<item name="android:maxHeight">20dip</item>
<item name="android:thumb">@android:drawable/seek_thumb</item>
<item name="android:thumbOffset">8px</item>
<item name="android:focusable">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)
因此,您可能希望覆盖所有这些并按照您的方式执行,就像您为标题栏所做的那样,通过定义自己的样式.
Yon*_*lan 13
我不确定Seekbars,但可以使用自定义样式(在styles.xml中定义)来自定义Progressbars,如下所示:
<style name="MyCustomProgressStyle">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@drawable/custom_progress_drawable</item>
<item name="android:indeterminateDrawable">@android:drawable/progress_indeterminate_horizontal</item>
<item name="android:minHeight">10dip</item>
<item name="android:maxHeight">10dip</item>
</style>
Run Code Online (Sandbox Code Playgroud)
然后你可以根据android系统设置一个自定义drawable progress_horizontal.xml(它在AOSP结账的frameworks/base/core/res/drawable文件夹中).这是一个开源项目的例子.
| 归档时间: |
|
| 查看次数: |
37220 次 |
| 最近记录: |