2013-11-28 2 views
0

목록보기 하단에 요약 데이터 5 줄을 표시해야합니다. 꼬리말을 만들었고 시도했습니다.티타늄으로 데이터 정렬

label1.text+num.toString() 
footer.add(label1) // repeat for 5 labels 
listview.add(footer) 

5 개의 레이블은 고정 길이 문자열이지만 올바르게 정렬되지는 않았습니다. 내가 tableviews에 대한 몇 가지 게시물을 읽었습니다, 내가 필요로하는이 무엇입니까?

편집 : 고정 폭 글꼴은 작동하지만 여전히 ...

답변

0

난 당신이 첫 번째 문에 오타가 있다고 생각 : 나는 그것이해야한다고 생각

label1.text+num.toString() 

:

label1.text = num.toString(); 

을 그것은 당신이 어떤 레이블도 보지 못했다고 설명 할 수 있습니다.

해결 방법이 아니며 라벨의 텍스트 속성이 진술 이전의 값으로 설정된 경우 더 많은 코드를 제공하여 도움을 받으십시오.

+0

오타가 잘못되었습니다. 불행히도, 나는 그것이 코드 문제라고 생각하지 않습니다. 비례 글꼴이있는 문자열은 정렬되지 않습니다. – Jocala

+0

나는 그것을 고쳤다. 컨테이너로 createview를 사용하고 요약 라인 레이블을 왼쪽과 같이 설정했습니다. 도와 줘서 고맙다. 내가 한 일을 보여주는 (간략한) 코드를 게시해야합니까? – Jocala

+0

네, 혼자서 알아 낸 경우 자신의 질문에 대한 답변을 게시 할 수 있습니다. 보관 된 질문을 통해 비슷한 문제를 가진 다른 사람에게 도움이 될 수 있습니다. – daniula

0

필자가 올바르게 라이닝하는 문제를 해결하기 위해 수행 한 작업은보기를 작성한 다음 상단/왼쪽 위치 지정을 사용하여 개별 요소를 추가하는 것이 었습니다.

var summary_win2 = Titanium.UI.createView({ 
    height: '50%', 
    top: 0 
}); 


// summary_win2.add(summary_win2_label0); 
// I did the above code for all the elements below 

var summary_win2_label0 = Titanium.UI.createLabel({ 
    text: "Data 1", 
    font:{fontSize:24,fontWeight:'normal'}, 
    color:'#000', 
    top: 0, 
    left:3 
}); 

var summary_win2_data0 = Titanium.UI.createLabel({ 
    text: "0", 
    font:{fontSize:24,fontWeight:'normal'}, 
    color:'#000', 
    top: 0, 
    left:120 
}); 

var summary_win2_label1 = Titanium.UI.createLabel({ 
    text: "Data 2", 
    font:{fontSize:24,fontWeight:'normal'}, 
    color:'#000', 
    top: 25, 
    left:3 
}); 

var summary_win2_data1 = Titanium.UI.createLabel({ 
    text: "0", 
    font:{fontSize:24,fontWeight:'normal'}, 
    color:'#000', 
    top: 25, 
    left:120 
}); 


var summary_win2_label2 = Titanium.UI.createLabel({ 
    text:"Data 3", 
    font:{fontSize:24,fontWeight:'normal'}, 
    color:'#000', 
    top: 50, 
    left:3 
}); 

var summary_win2_data2 = Titanium.UI.createLabel({ 
    text: "0", 
    font:{fontSize:24,fontWeight:'normal'}, 
    color:'#000', 
    top: 50, 
    left:120 
}); 


var summary_win2_label3 = Titanium.UI.createLabel({ 
    text: "Data 4", 
    font:{fontSize:24,fontWeight:'normal'}, 
    color:'#000', 
    top: 75, 
    left:3 
}); 

var summary_win2_data3 = Titanium.UI.createLabel({ 
    text: "0", 
    font:{fontSize:24,fontWeight:'normal'}, 
    color:'#000', 
    top: 75, 
    left:120 
}); 

var buttonClear_win2 = Titanium.UI.createButton({ 
    title: 'Clear', 
    top: 110, 
    width: 100, 
    height: 50, 
    left: 0 
}); 
관련 문제