【发布时间】:2012-05-13 00:24:03
【问题描述】:
我需要以编程方式找出默认情况下Android 使用哪个drawable 来呈现ProgressBar。由于这取决于所使用的主题,因此我尝试了以下方法:
TypedArray progressBarAttrs = context.getTheme().obtainStyledAttributes(
new int[] { android.R.attr.indeterminateDrawable });
progressDrawableId = progressBarAttrs.getResourceId(0, -1);
但这总是返回 -1。
这是因为android.R.attr.indeterminateDrawable 没有被声明为可样式化还是什么?有没有其他方法可以达到同样的目的?
【问题讨论】: