0

클릭 here! 넥서스 5와 은하계의 핵심에 찍은 스크린 샷을 볼 수 ... 은하 코어에서 은, 모든 좋은 것처럼 보이지만 넥서스 5의 위젯 인해 내가 설정 한 ... 다른 화면 크기로 왼쪽으로 이동 얻을다른 화면 크기의 티타늄 합금 위젯 위치 지정 문제

<property name="ti.ui.defaultunit" type="string">dp</property> 
내 tiapp.xml

내 xml 파일은 다음과 같다에서

...

<Alloy> 
<Window id='PreferenceScreen' > 
    <Button id='button_save' title="Save"/> 
    <Label id='label_my_project' >My project</Label> 
    <Label id='label_select_city' > 
    </Label> 
    <Label id='label_select_locality' > 
    </Label> 
</Window> 
</Alloy> 

---- 내 TSS 파일 ----

'#label_my_project': { 
top: '88', 
left: '20', 
width: '280', 
backgroundColor: '#00aac1', 
color: '#ffffff', 
text: 'My Project', 
textAlign: 'center', 
font: { 
    fontSize: '25sp' 
} 
}, 
'#label_select_city[platform=android]': { 
hintText: 'Select City' 
}, 
'#label_select_city': { 
top: '143', 
left: '40', 
width: '240', 
font: { 
    fontSize: '20sp' 
} 
}, 
'#label_select_locality[platform=android]': { 
hintText: 'Select Locality' 
}, 
'#label_select_locality': { 
top: '214', 
left: '40', 
width: '240', 

font: { 
    fontSize: '20dpsp' 
} 
}, 
'#button_save': { 
top: '293', 
left: '58', 
width: '200', 
borderWidth: 1, 
borderRadius: 5, 
borderColor: '#fff', 
backgroundColor: '#00aac1', 
backgroundSelectedColor: '#fff', 
color: '#ffffff', 
selectedColor: '#00aac1', 
textAlign: 'center', 
font: { 
    fontSize: '20sp' 
} 
}, 
'#PreferenceScreen[platform=android]': { 
fullscreen: false 
}, 
'#PreferenceScreen': { 
top: '0', 
left: '0', 
backgroundColor: '#00aac1', 
navGroup: '' 
}, 
012 3,516,

또한 % 만 같은 결과를 시도

내가 이일 과거부터 갇혀대로 도와주세요 여전히 해결책 ...

답변

0

모든 요소를 ​​중심 하시겠습니까?

VIEW :

<Alloy> 
<Window id='PreferenceScreen' > 
    <View id='container'> 
     <Label id='label_my_project' >My project</Label> 
     <Label id='label_select_city' > 
     </Label> 
     <Label id='label_select_locality' > 
     </Label> 
     <Button id='button_save' title="Save"/> 
    </View> 
</Window> 
</Alloy> 

TSS :

'#label_my_project': { 
    //top: '88', 
    //left: '20', 
    width: '280', 
    backgroundColor: '#00aac1', 
    color: '#ffffff', 
    text: 'My Project', 
    textAlign: 'center', 
    font: { 
     fontSize: '25sp' 
    } 
}, 
'#label_select_city[platform=android]': { 
    hintText: 'Select City' 
}, 
'#label_select_city': { 
    top: '40dp', 
    //left: '40', 
    width: '240', 
    backgroundColor:'white', 
    font: { 
     fontSize: '20sp' 
    } 
}, 
'#label_select_locality[platform=android]': { 
    hintText: 'Select Locality' 
}, 
'#label_select_locality': { 
    top: '40dp', 
    //left: '40', 
    width: '240', 
    backgroundColor:'white', 
    font: { 
      fontSize: '20dpsp' 
    } 
}, 
'#button_save': { 
    //left: '58', 
    top:'40dp', 
    width: '200', 
    borderWidth: 1, 
    borderRadius: 5, 
    borderColor: '#fff', 
    backgroundColor: '#00aac1', 
    backgroundSelectedColor: '#fff', 
    color: '#ffffff', 
    selectedColor: '#00aac1', 
    textAlign: 'center', 
    font: { 
     fontSize: '20sp' 
    } 
}, 
'#PreferenceScreen[platform=android]': { 
    fullscreen: false 
}, 
'#PreferenceScreen': { 
    top: '0', 
    left: '0', 
    width:Ti.UI.fill, 
    height:Ti.UI.FILL, 
    backgroundColor: '#00aac1', 
    navGroup: '' 
}, 
"#container":{ 
    layout:'vertical', 
    height:Ti.UI.SIZE, 
} 
그냥 시도이 코드를 모든 레이블에

width:'auto' 

를 사용하고 PreferenceScreen

Ti.UI.FILL 

+0

화면 크기가 다른데도 같은 위치에 요소를 배치하면 ... –

+0

코드를 시험해보고 대답을 추가하십시오! – Jeroen

+0

이것은 단지 요소 중심에 위치합니다 ... 화면의 높이가 더 큰 경우에는 어떻게합니까 ??? –