ContentLoadingProgressBar

来源:互联网 发布:联通 电信哪个4g网络好 编辑:程序博客网 时间:2024/06/01 07:25

Android5.0之后推出一系列的新组件 ContentLoadingProgressBar 也是其中一个 

java.lang.Object   ↳android.view.View    ↳android.widget.ProgressBar     ↳

android.support.v4.widget.ContentLoadingProgressBar 

从层级关系可以看出他是直接继承ProgressBar的父类。在ProgressBar的基础上衍生了自己的共有方法

(1)contentLoadingProgressBar.hide()官方给出的解释 Hide the progress view if it is visible.

(2)contentLoadingProgressBar.show() Show the progress view after waiting for a minimum delay.

(3)contentLoadingProgressBar.onAttachedToWindow(); This is called when the view is attached to a window. 

(4)contentLoadingProgressBar.onDetachedFromWindow() This is called when the view is detached from a window.

等等。在progressbar的基础上优化了好多。他的布局也是很简单。

  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  2.     xmlns:tools="http://schemas.android.com/tools" 
  3.     android:layout_width="match_parent" 
  4.     android:layout_height="match_parent" 
  5.     android:orientation="vertical" > 
  6.  
  7.     <android.support.v4.widget.ContentLoadingProgressBar 
  8.         android:id="@+id/progress" 
  9.         style="?android:attr/progressBarStyleLarge" 
  10.         android:layout_width="wrap_content" 
  11.         android:layout_height="wrap_content" /> 
  12.  
  13. </LinearLayout> 

 

0 0
原创粉丝点击