ContentLoadingProgressBar的示例用法

Lal*_*h B 16 android android-view

我刚跳过,ContentLoadingProgressBar从android开发者网站上找到了这个类.我搜索了找不到该课程的任何用法或解释.我已经列出了关于课程的几个问题,如果有人回答它会很棒.

  1. 它与ProgressBar有什么不同?
  2. 我们应该自己展示/隐藏ProgressBar吗?
  3. 设计ProgressBar的样式?

https://developer.android.com/reference/android/support/v4/widget/ContentLoadingProgressBar.html

小智 30

我试过这个:

<android.support.v4.widget.ContentLoadingProgressBar
        android:id="@+id/address_looking_up"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:visibility="visible" />
Run Code Online (Sandbox Code Playgroud)

它适用于Android 5.0.我觉得这个风格在我考试后很重要.

这个小部件的显示效果取决于你的应用程序的主题,我很害怕.

  • `style ="?android:attr /?android:attr/progressBarStyleLarge"`有一个拼写错误,应该是`style ="?android:attr/progressBarStyleLarge"` (5认同)

Zha*_*arf 7

我能够让这件事对我有用,但它需要对我从grepcode中获取的源代码进行一些修改.

我删除了onAttachedToWindow()覆盖,因为我觉得在这种情况下没有必要删除回调.重写的方法调用造成show()onResume()到不行,因为回调后进行正确的去除.

我还必须弄清楚为什么视图显然没有被绘制,我认为原因是传递给ProgressBar构造函数的第三个参数所以我改变了构造ProgressBar函数直接调用构造函数而不修改参数.

我的这个类的版本可以在这里找到

我的答案:

  1. 如果hide()在show()之后调用小于0.5秒,它根本不显示,并且它显示至少0.5秒,这可以防止你在"天真"实现中看到的非常快速的闪烁内容.
  2. 我认为这只是造型的常规案例 ProgressBar