2
我正在開發使用Titanium SDK的多平臺應用程序。 然後,此代碼在iOS上運行良好,但無法在android上運行。 我在這裏編寫.tss和.xml代碼。子圖像,標籤和按鈕不顯示在Android模擬器上的鈦
-----------------。tss file -------------------------
".container": {
backgroundColor:"white"
}
"#select_language_pannel": {
layout: 'vertical',
width: '84%',
height: '45%',
image: '/images/select_language_pannel.png'
}
"#language_label":{
top: '20%',
color : '#008c99',
width: '100%',
textAlign: 'center',
text: L('select_language'),
font: {fontSize: '18dp', fontWeight:"bold"}
}
"#arabic_button": {
layout: 'vertical',
top: '40%',
width: '64%',
height: '13%',
backgroundImage : '/images/btn_login_common_normal.png',
backgroundSelectedImage: '/images/btn_login_common_pressed.png'
}
"#arabic_text": {
layout: 'vertical',
color: '#008c99',
height: '100%',
highlightedColor: '#FFFFFF'
}
"#english_button": {
layout: 'vertical',
top: '60%',
width: '64%',
height: '13%',
backgroundImage : '/images/btn_login_common_normal.png',
backgroundSelectedImage: '/images/btn_login_common_pressed.png'
}
"#english_text": {
color: '#008c99',
height: '100%',
highlightedColor: '#FFFFFF'
}
"#select_language_pannel": {
layout: 'vertical',
width: '84%',
height: '45%',
image: '/images/select_language_pannel.png'
}
"#language_label":{
top: '20%',
color : '#008c99',
width: '100%',
textAlign: 'center',
text: L('select_language'),
font: {fontSize: '18dp', fontWeight:"bold"}
}
"#arabic_button": {
layout: 'vertical',
top: '40%',
width: '64%',
height: '13%',
backgroundImage : '/images/btn_login_common_normal.png',
backgroundSelectedImage: '/images/btn_login_common_pressed.png'
}
"#arabic_text": {
layout: 'vertical',
color: '#008c99',
height: '100%',
highlightedColor: '#FFFFFF'
}
"#english_button": {
layout: 'vertical',
top: '60%',
width: '64%',
height: '13%',
backgroundImage : '/images/btn_login_common_normal.png',
backgroundSelectedImage: '/images/btn_login_common_pressed.png'
}
"#english_text": {
color: '#008c99',
height: '100%',
highlightedColor: '#FFFFFF'
}
-----------------。xml文件-----------------
<Alloy>
<Window class="container" id = "win">
<ImageView image="/images/selectlanguage_bg.png">
<ImageView id="select_language_pannel">
<Label id = "language_label"></Label>
<Button id = "arabic_button" onClick="onClickArabic" onFocus="onFocusArabic" >
<Label id = "arabic_text" zIndex="100">عـربـي</Label>
</Button>
<Button id = "english_button" onClick="onClickEnglish" onFocus="onFocusEnglish">
<Label id = "english_text" zIndex="100">ENGLISH</Label>
</Button>
</ImageView>
</ImageView>
</Window>
</Alloy>
Rene是對的。在iOS上可以在按鈕內放置標籤或活動指示器。 在Android上這不起作用。我建議你改變ImageView爲一個簡單的視圖,而不是「圖像」使用「backgroundImage」 –