【发布时间】:2018-01-10 02:23:44
【问题描述】:
我一直在开发一个多平台移动应用程序。我几乎完成了它,但我总是在 iOS 上进行测试(由于某些原因)。现在我可以在 Android 上进行测试,发现它在很多方面都失败了。
这里的主要问题是当我使用时:
alloy.createSomeElement({
//params
})
$.someView.add(someElemet);
元素未添加到视图中。正如我所提到的,这只发生在 Android 上并且在 iOS 上运行良好。
这里我向您展示一个示例,它是两个平台的结果。
e.json.forEach(function(address) {
var addressView = Ti.UI.createView({
height : Ti.UI.SIZE,
width : '90%',
layout : 'horizontal',
touchEnabled : true,
Address_id : address.id
});
var icoCont = Ti.UI.createView({
height : 20,
width : '10%'
});
var icon = Ti.UI.createImageView({
height : '20',
width : '20',
image : "/compartidos/persona3.png",
touchEnabled : false
});
var addressText = Ti.UI.createLabel({
height : Ti.UI.SIZE,
width : Ti.UI.FILL,
left : 1,
text : address.street + " - " + address.ext_number,
font : {
fontSize : 12,
fontFamily : "Nunito-Bold",
},
touchEnabled : false,
color: "#000"
});
if (address.alias)
addressText.text = address.alias;
var separator = Ti.UI.createView({
height : 5,
width : '100%',
top : 5,
bottom : 5,
backgroundColor : '#8C000000',
touchEnabled : false
});
addressView.add(icoCont, addressText);
icoCont.add(icon);
$.container.add(addressView, separator);
});
iOS 上的结果:result on iOS
这在 Android 上:result on Android
我真的希望你能帮我解决这个问题。
注意:Nueva dirección 和 Dirección actual 不是这样生成的,它们存在于 xml 文件中。
【问题讨论】:
标签: javascript android xml titanium appcelerator