【发布时间】:2015-03-25 21:32:16
【问题描述】:
我从我的 ListView 项目中得到重复的值(就像文本上的文本)。
这是我的问题(我不确定图片是否会上传):
而我的 ListView 代码是:
<ListView id="listView" defaultItemTemplate="template" onItemclick="menuOptions">
<!-- The Templates tag sets the ListView's templates property -->
<Templates>
<!-- Define your item templates within the Templates tags or use the
Require tag to include a view that only contains an ItemTemplate -->
<ItemTemplate name="template">
<ImageView bindId="pic" id="icon" />
<Label id="petLabel" />
<Label id="needleLable" />
<Label id="heightControl"/>
</ItemTemplate>
</Templates>
<ListSection>
<ListItem id="petLabel" val="mascota" pic:image="/images/menu/footprint.png"/>
<ListItem id="needleLable" val="vacuna" pic:image="/images/menu/pet.png"/>
<ListItem id="heightControl" val="estadistica" pic:image="/images/menu/pet.png"/>
</ListSection>
</ListView>
在我用于国际化的文件(平台/android/values-en 和 values-es)中,我得到了这个:
字符串.xml
<resources>
<!--Menu -->
<string name="itemPet">Pet Profile</string>
<string name="itemNeedle">Needle</string>
<string name="itemHeight">Height Control</string>
</resources>
和价值观-es
<resources>
<!--Menu -->
<string name="itemPet">Mascota</string>
<string name="itemNeedle">Ver Vacunas</string>
<string name="itemHeight">Control de peso</string>
</resources>
最后是我调用要显示的文本的 .tss 文件:
'#petLabel':{
textAlign: Titanium.UI.TEXT_ALIGNMENT_CENTER,
text:L('itemPet'),
font:{
fontSize:30,
fontWeight:'bold',
fontFamily:'clear-sans.light'
}
}
'#needleLable':{
textAlign: Titanium.UI.TEXT_ALIGNMENT_CENTER,
text: L('itemNeedle'),
font:{
fontSize:30,
fontWeight:'bold',
fontFamily:'clear-sans.light'
}
}
'#heightControl':{
textAlign: Titanium.UI.TEXT_ALIGNMENT_CENTER,
text:L('itemHeight'),
font:{
fontSize:30,
fontWeight:'bold',
fontFamily:'clear-sans.light'
}
}
我不知道为什么会这样,我尝试了很多东西都无法解决,任何想法都会有用。
谢谢。
附加信息:
当我单击 ListItem 时,我做了一个警报,该事件得到了该事件,警报返回:
{properties={height=100dp, accessoryType=0, textAlign=center, font={fontWeight=bold, fontSize=30, fontFamily=clear-sans.light}, title=Ver Vacunas, val=vacuna, id= needleLable}, pic={image=/images/menu/pet.png}}
标题显示正确的文字,但问题仍然存在。
【问题讨论】:
标签: listview internationalization titanium