2013-05-13 80 views
7

我正在寻找一个工作得很好的酒吧。但是我想增加进度条的高度,因为原生高度不是很高。寻求酒吧增加高度

因此,我可以动态地或通过XML更改进度条的高度?

+0

- 您是否修复了XML中seekbar的高度? – TheFlash 2013-05-13 07:12:03

回答

18

你可以通过XML来做到这一点。

它可以在您的应用程序中正常工作。您可以在您提到的进度条标签的XML中进行这种简单集成。

首先,您需要在项目的values-> styles.xml中定义进度条的样式。例如:

<style name="tallerBarStyle" parent="@android:style/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">8dip</item> 
<item name="android:maxHeight">20dip</item> 
</style> 

将maxHeight编辑到您想要达到的高度。

然后在你的进度补充:

android:style="@style/tallerBarStyle" 

这将很好地工作。

9

您必须为所有方向添加一些填充还设置seekbar的最小和最大高度。 这里是我使用的一个例子。

<?xml version="1.0" encoding="utf-8"?> 
<SeekBar xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     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_centerVertical="true"/>