如何设置Android进度条的高度? [英] How to set the Android progressbar's height?

查看:37
本文介绍了如何设置Android进度条的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 activity_main.xml 在下面,如您所见,高度设置为 40 倾角.

My activity_main.xml is below, as you see, the height is set 40 dip.

在 MyEclipse 中,它如下所示:

And in MyEclipse, it looks like below:

但是当我在手机上运行它时,它看起来像下图:

But when I run it on my phone, it looks like below:

所以我的问题是为什么进度条的实际高度不是我设置的?如何增加进度条的高度?

So my question is why the real height of the progressbar is not the one I set? How to increase the height of the progressbar?

推荐答案

来自 本教程:

<style name="CustomProgressBarHorizontal" parent="android:Widget.ProgressBar.Horizontal">
      <item name="android:progressDrawable">@drawable/custom_progress_bar_horizontal</item>
      <item name="android:minHeight">10dip</item>
      <item name="android:maxHeight">20dip</item>
</style>

然后简单地将样式应用到您的进度条或更好,覆盖主题中的默认样式以自动设置所有应用进度条的样式.

Then simply apply the style to your progress bars or better, override the default style in your theme to style all of your app's progress bars automatically.

您在屏幕截图中看到的差异是因为手机/模拟器使用的是不同的 Android 版本(最新的是 ICS (Holo) 的主题,顶部是原始主题).

The difference you are seeing in the screenshots is because the phones/emulators are using a difference Android version (latest is the theme from ICS (Holo), top is the original theme).

这篇关于如何设置Android进度条的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆