【问题标题】:ProgressBar: indeterminate + show progress (like google play store)ProgressBar:不确定 + 显示进度(如 google play store)
【发布时间】:2013-06-20 12:04:45
【问题描述】:

想使用类似 google play store 的进度条。

首先它(进度条)是不确定的——它显示为不断移动的加载。然后它显示进度 - 从 0 到 100

在我的情况下,bar 只显示不确定或进度 - 取决于 xml-config。 有什么建议吗?

我的进度条: 这里的栏显示了短时间的移动负载。下载开始时,进度条会自行消失。 没有 android:indeterminate="true" 没有不确定,并且 bar 只显示进度。 我的进度由 progress.setProgress((int) _self.currentProgress); 改变;

<ProgressBar
                android:id="@+id/progress"
                android:indeterminate="true"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="5dip"
                style="@style/ProgressBarHoloHorizontal"/>

风格:

<style name="ProgressBarHoloHorizontal">
    <item name="android:indeterminateOnly">false</item>
    <item name="android:indeterminateDrawable">@drawable/progress_indeterminate_horizontal_holo</item>
    <item name="android:minHeight">16dip</item>
    <item name="android:maxHeight">16dip</item>
    <item name="android:progressDrawable">@drawable/progress_horizontal_holo_light</item>
</style>

【问题讨论】:

  • 当您为进度条设置进度时,不确定状态应该消失,如果不是在您获得第一个进度时输入progress.setIndeterminate(false);
  • 谢谢,@zozelfelfo!这是正确的解决方案

标签: android


【解决方案1】:

使用这个

progress.setIndeterminate(false);

从不确定的进度条变为确定的进度条

【讨论】:

  • 如前所述(参见@zozelfelfo 评论)progress.setIndeterminate(false) 应该在获得第一个进度时添加到位
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-11-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多