gpt4 book ai didi

titanium - 如何在 Titanium 中的按钮上放置图像和标签?

转载 作者:行者123 更新时间:2023-12-01 05:38:23 24 4
gpt4 key购买 nike

下面是我的代码。它在 iPhone 上完美运行,但图像在 Android 上被拉伸(stretch),所以它没有显示标签。

var friendsButton = Titanium.UI.createButton({
top : 0,
left : 91,
width : 90,
height : 101,
style : 0,
backgroundImage : '/img/buttonMiddle.png',
image : '/img/friendcopy.png'
});
var friendLabel = Titanium.UI.createLabel({
top : 35,
left : 25,
width : 100,
height : 100,
text : 'Friend',
color : 'white',
font : {fontSize:12}
});
friendsButton.add(friendLabel);

请帮助我。我是钛新手

最佳答案

尝试在 Android 中设置所有对象(按钮/标签)属性,例如:

var friendLabel = Titanium.UI.createLabel({
top : '35dp',
left : '25dp',
width : '100dp',
height : '100dp',
text : 'Friend',
color : 'white',
font : {fontSize:'12dp'}
});

希望这可以帮助。

关于titanium - 如何在 Titanium 中的按钮上放置图像和标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7343746/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com