我想在 Black Berry 10 开发中使用 Cascades 创建一个按钮,它有一个图像作为背景,也可能有一个白色的文本。我找到了这个类 button , 但它似乎不支持将图像设置为按钮上的背景。我能做些什么?有哪些替代方法? 也许我应该考虑使用 Cascades 以外的其他库来创建我的 UI???有什么建议吗?
最佳答案
Container {
id:account
signal buttonClicked()
layout: DockLayout {
}
preferredWidth: 768.0
topMargin: 40.0
bottomMargin: 40.0
ImageButton {
id: addButton
defaultImageSource: "image/button_normal.png"
pressedImageSource: "image/button_press.png"
horizontalAlignment: HorizontalAlignment.Center
onClicked: {
buttonClicked();
}
}
Label {
text: "Add"
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Center
textStyle {
base: SystemDefaults.TextStyles.BodyText
fontSize: FontSize.Small
color: Color.create("#ffffff")
}
touchPropagationMode: TouchPropagationMode.None
}
}
关于c++ - 在 Cascades 上创建一个带有背景图片的按钮,BB-10,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14772782/