如何设置安卓进度的高度?如何设置、高度、卓进

2023-09-06 01:53:35 作者:跪下、叫帅哥

我的 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?

推荐答案

从this教程:

<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.

您所看到的截图不同的是,因为手机/仿真器使用的是不同的Andr​​oid版本(最新的从ICS(全息主题),上面是原来的主题)。

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).