Titanium 如何在touchStart上启用按钮焦点?

Titanium 如何在touchStart上启用按钮焦点?,titanium,titanium-mobile,titanium-alloy,tss,Titanium,Titanium Mobile,Titanium Alloy,Tss,我已经创建了一个按钮,我需要一些来自按钮的响应,在触摸按钮时,按钮的焦点应该能够在背景色中进行类似的更改。我该怎么做 我的密码是, 视图: 控制器: 上述代码不起作用。只是我需要稍微改变背景颜色,而触摸按钮 任何解决方案 使用此属性并传递颜色代码 backgroundSelectedColor : "RED" 对于普通视图,“聚焦”必须为true。 有关更多信息,请参阅此 我希望它可以帮助您使用此属性并传递颜色代码 backgroundSelectedColor : "RED" 对于普通视图

我已经创建了一个按钮,我需要一些来自按钮的响应,在触摸按钮时,按钮的焦点应该能够在背景色中进行类似的更改。我该怎么做

我的密码是, 视图:

控制器:

上述代码不起作用。只是我需要稍微改变背景颜色,而触摸按钮


任何解决方案

使用此属性并传递颜色代码

backgroundSelectedColor : "RED"
对于普通视图,“聚焦”必须为true。 有关更多信息,请参阅此


我希望它可以帮助您使用此属性并传递颜色代码

backgroundSelectedColor : "RED"
对于普通视图,“聚焦”必须为true。 有关更多信息,请参阅此


我希望它可以帮助您,

正如@CodeForFun提到的,您可以使用按钮的backgroundSelectedColor属性

以下是钛制按钮可以使用的所有状态

残疾人士:及 正常:及 焦点:及 选定:和 希望这会有帮助

编辑:用法示例:

视图:


正如@CodeForFun提到的,您可以使用按钮的backgroundSelectedColor属性

以下是钛制按钮可以使用的所有状态

残疾人士:及 正常:及 焦点:及 选定:和 希望这会有帮助

编辑:用法示例:

视图:


AlloyXML是这样的

进行

那么按钮属性应该是这样的

".button":{
 width: '50%',
 top: '25dp',
 borderRadius: 8,
 borderWidth: 1,
 borderColor: '#808080',
 backgroundSelectedColor : "red",
 backgroundSelectedImage : "/my_image.png",
 backgroundGradient: {
    type: "linear",
    startPoint: { x: "0%", y:"0%"},
    endPoint:   { x: "0%", y:"100%"},
    colors: [
        { color: "#4F94CD", offset: 0.0 },
        { color: "#4F94CD", offset: 1.0 }
    ]
  }
}
您可以在触摸焦点上设置所选图像或背景色。 您不需要在控制器中编写的控制器代码。 对于某些对象,也可以选择颜色。
您还可以设置backgroundFocusedImage,

合金xml如下

进行

那么按钮属性应该是这样的

".button":{
 width: '50%',
 top: '25dp',
 borderRadius: 8,
 borderWidth: 1,
 borderColor: '#808080',
 backgroundSelectedColor : "red",
 backgroundSelectedImage : "/my_image.png",
 backgroundGradient: {
    type: "linear",
    startPoint: { x: "0%", y:"0%"},
    endPoint:   { x: "0%", y:"100%"},
    colors: [
        { color: "#4F94CD", offset: 0.0 },
        { color: "#4F94CD", offset: 1.0 }
    ]
  }
}
您可以在触摸焦点上设置所选图像或背景色。 您不需要在控制器中编写的控制器代码。 对于某些对象,也可以选择颜色。
您还可以设置backgroundFocusedImage,

在哪里可以使用此属性?在按钮属性上添加此属性。从控制器中删除触摸开始和触摸结束事件列表,只需添加backgroundSelectedColor:RED的属性。@CodeForFun抱歉,您没有提到正确的答案。我在哪里可以使用此属性?在按钮属性上添加此属性。从控制器中删除触摸开始和触摸结束事件列表器,只需添加backgroundSelectedColor:RED的属性。@CodeForFun抱歉,您没有提到正确的答案。我在哪里可以使用backgroundSelectedColor属性?我在哪里可以使用backgroundSelectedColor属性?
<Button class="button" >Proceed</Button>
".button":{
width: '50%',
top: '25dp',
backgroundSelectedColor : "#4F94CD" //usage
}
".button":{
 width: '50%',
 top: '25dp',
 borderRadius: 8,
 borderWidth: 1,
 borderColor: '#808080',
 backgroundSelectedColor : "red",
 backgroundSelectedImage : "/my_image.png",
 backgroundGradient: {
    type: "linear",
    startPoint: { x: "0%", y:"0%"},
    endPoint:   { x: "0%", y:"100%"},
    colors: [
        { color: "#4F94CD", offset: 0.0 },
        { color: "#4F94CD", offset: 1.0 }
    ]
  }
}