【问题标题】:How to show ContentLoadingProgressBar with horizontal indeterminate style如何显示具有水平不确定样式的 ContentLoadingProgressBar
【发布时间】:2015-08-29 08:42:32
【问题描述】:

我正在尝试使用 ContentLoadingProgressBar 实现水平不确定的进度条样式。下面是xml布局

 <android.support.v4.widget.ContentLoadingProgressBar
                android:id="@+id/pbar_Cloud"
                style="?android:attr/progressBarStyleHorizontal"
                android:layout_width="match_parent"
                android:layout_height="10dp"
                android:layout_gravity="bottom"
                android:visibility="visible" />

进度条显示为没有进度的空水平线。 通过设置

style="?android:attr/progressBarStyleLarge"

循环不确定进度显示正常。我错过了什么,我什至尝试过

ContentLoadingProgressBar bar = (ContentLoadingProgressBar) findViewById(R.id.pbar_Cloud);
bar.setActivated(true);
bar.show();

还是没有运气。

【问题讨论】:

    标签: android android-layout


    【解决方案1】:

    我知道这是很久以前问过的,但万一其他人在这里遇到同样的问题:

    您只需将android:indeterminate="true" 添加到您的xml:

    <android.support.v4.widget.ContentLoadingProgressBar
                    android:id="@+id/pbar_Cloud"
                    style="?android:attr/progressBarStyleHorizontal"
                    android:layout_width="match_parent"
                    android:layout_height="10dp"
                    android:layout_gravity="bottom"
                    android:visibility="visible" 
                    android:indeterminate="true"/>
    

    希望有帮助!

    更新:

    对于那些迁移到 AndroidX 的人,只需更新您的标签即可使用

    <androidx.core.widget.ContentLoadingProgressBar
    ...
    android:indeterminate="true"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-20
      • 2019-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-16
      • 1970-01-01
      • 2012-07-07
      相关资源
      最近更新 更多