Closed JSnail closed 5 years ago
ProcessBar.java的构造方法中有这样一段代码:
final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.ProgressBar, defStyleAttr, defStyleRes);
..
...
final Drawable indeterminateDrawable = a.getDrawable(
R.styleable.ProgressBar_indeterminateDrawable);
if (indeterminateDrawable != null) {
if (needsTileify(indeterminateDrawable)) {
setIndeterminateDrawableTiled(indeterminateDrawable);
} else {
setIndeterminateDrawable(indeterminateDrawable);
}
}
ProcessBar.java代码注释中也有提供这些属性声明:
* @attr ref android.R.styleable#ProgressBar_animationResolution
* @attr ref android.R.styleable#ProgressBar_indeterminate
* @attr ref android.R.styleable#ProgressBar_indeterminateBehavior
* @attr ref android.R.styleable#ProgressBar_indeterminateDrawable
* @attr ref android.R.styleable#ProgressBar_indeterminateDuration
* @attr ref android.R.styleable#ProgressBar_indeterminateOnly
* @attr ref android.R.styleable#ProgressBar_interpolator
* @attr ref android.R.styleable#ProgressBar_min
* @attr ref android.R.styleable#ProgressBar_max
* @attr ref android.R.styleable#ProgressBar_maxHeight
* @attr ref android.R.styleable#ProgressBar_maxWidth
* @attr ref android.R.styleable#ProgressBar_minHeight
* @attr ref android.R.styleable#ProgressBar_minWidth
* @attr ref android.R.styleable#ProgressBar_mirrorForRtl
* @attr ref android.R.styleable#ProgressBar_progress
* @attr ref android.R.styleable#ProgressBar_progressDrawable
* @attr ref android.R.styleable#ProgressBar_secondaryProgress
Hope this help you.
非常感谢
private static int getProgressBarIndeterminateDrawableIndex() { if ( sProgressBarIndeterminateDrawableIndex == 0 ) { Object o = ReflectUtils.getField( "com.android.internal.R$styleable", "ProgressBar_indeterminateDrawable" ); if ( o != null ) { sProgressBarIndeterminateDrawableIndex = (int) o; } } return sProgressBarIndeterminateDrawableIndex; }
以上两个方法里面的"ProgressBar_indeterminateDrawable" 和"ProgressBar"是从什么地方得到的呢,我想增加style中其他属性的解析方法,但是不知道这个字段应该是什么