【问题标题】:Titanium Android: indicatorColor property is not working Activity IndicatorTitanium Android:indicatorColor 属性不起作用 Activity Indicator
【发布时间】:2017-06-23 09:44:40
【问题描述】:

我刚刚尝试在 Titanium 的 android App 中更改 Activity 指示器的颜色,发现该属性没有按预期工作。为此,我编写了以下代码:

var win = Ti.UI.createWindow(
{ backgroundColor : "#fff" });

var activityIndicator = Ti.UI.createActivityIndicator(
{ indicatorColor :"red"});

activityIndicator.show();

win.add(indicatorHolder);

win.open();

有人有答案吗?

Screen shot of the above code

我正在使用 Studio,构建:4.8.1.201612050850 开发工具包:6.0.1.GA 类型:安卓应用

【问题讨论】:

    标签: android titanium appcelerator titanium-alloy titanium-android


    【解决方案1】:

    indicatorProperty 仅适用于 iOS。我认为有关此属性的文档未正确编写/验证。

    在 iOS 中,您可以使用此属性。

    在 Android 中,您可以使用自定义主题,将以下属性设置为您想要的颜色:

    <item name="colorAccent">#f00</item>

    请注意,此 item 属性还会更改许多元素的颜色主题,因此在使用主题之前请阅读 colorAccent 用法。

    【讨论】:

    • 我尝试在自定义主题中实现标签,但它仍然无法在 android 中运行。
    • 请注意,这是一个 Material Design 属性,仅适用于 API lvl 21+ (Android 5.0+)。如果您低于此版本,此答案将不起作用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-06
    • 1970-01-01
    • 1970-01-01
    • 2011-03-31
    • 2018-11-19
    相关资源
    最近更新 更多