【问题标题】:TypedArray ?android can't get proper valueTypedArray ?android 无法获得正确的值
【发布时间】:2014-12-23 03:34:46
【问题描述】:

这就是我想要实现的目标:

xml文件

app:loaderStyle="?android:attr/progressBarStyleLarge"

代码

int loaderStyle = loaderProperties.getResourceId(R.styleable.LoaderButton_loaderStyle,
            android.R.attr.progressBarStyleSmall);
...
mLoader = new ProgressBar(getContext(), null, loaderStyle);

但是

loaderStyle != android.R.attr.progressBarStyleLarge

你知道为什么吗?

【问题讨论】:

    标签: android android-progressbar typedarray


    【解决方案1】:

    它可以工作,但我必须使用 style 属性。也许对某人来说它会很有用。欢迎提供更高级的答案

    xml文件

    style="?android:attr/progressBarStyleLarge"
    

    代码

    mLoader = new ProgressBar(getContext(), null, mAttributeSet.getStyleAttribute());
    

    【讨论】:

      猜你喜欢
      • 2020-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-25
      • 1970-01-01
      • 1970-01-01
      • 2020-04-09
      • 1970-01-01
      相关资源
      最近更新 更多