2017-07-31 41 views
0

我是钛合金新材料,面临着合金中Tableviewrow高度的问题。我的要求是根据内容设置Tableviewrow的高度。我尝试了很多,但没有取得成功。我History.xml代码:钛合金中表观骨料的动态高度

<Alloy> 
<TableViewRow id="row" onClick="openHistoryDetail"> 
    <View id="rowView" width="Ti.UI.FILL"> 
     <View id="contentView"> 
      <View id="leftView"> 
       <ImageView id="leftImage" /> 
      </View> 
      <View id="details" top="0"> 
       <View width="100%" height="Titanium.UI.FILL" layout="horizontal"> 
        <View width="65%" layout="vertical"> 
         <Label id="topupCategory" class="mediumFont" text="" /> 
         <Label id="phone" class="smallFont" text="" /> 
         <Label id="date" class="smallFont" colocolor="#000" text="" /> 
        </View> 
        <View width="35%" layout="vertical"> 
         <Label id="transfered_amount" class="amtBalance" text="" /> 
         <Label id="available_amount" class="mediumFont" text="" /> 
        </View> 
       </View> 
      </View> 
     </View> 
    </View> 
</TableViewRow> 

和.tss文件包含:

"#row[platform=ios]": { 
width : Titanium.UI.FILL, 
height : Titanium.UI.FILL, 
backgroundColor : "#ececec", 
selectionStyle : Titanium.UI.iPhone.TableViewCellSelectionStyle.NONE} 

"#row[platform=android]": { 
width : Titanium.UI.FILL, 
height : Titanium.UI.FILL, 
backgroundColor : "#ececec"} 

"#rowView":{ 
width : Titanium.UI.FILL, 
height : Titanium.UI.FILL, 
backgroundColor : "#ececec", 
zIndex : 2, 
borderWidth : 0.5, 
borderColor : "#dadada"} 

"#contentView":{ 
width : "100%", 
height : Titanium.UI.SIZE, 
backgroundColor : "#ececec"} 

不知道如何可以根据内容我设置Tableviewrow高度?在此先感谢

回答

0

您应该根据更改下面的代码:

TSS:

"#row[platform=ios]": { 
width : Titanium.UI.FILL, 
height : Titanium.UI.SIZE, 
backgroundColor : "#ececec", 
selectionStyle : Titanium.UI.iPhone.TableViewCellSelectionStyle.NONE} 

"#row[platform=android]": { 
width : Titanium.UI.FILL, 
height : Titanium.UI.SIZE, 
backgroundColor : "#ececec"} 

"#rowView":{ 
width : Titanium.UI.FILL, 
height : Titanium.UI.SIZE, 
backgroundColor : "#ececec", 
zIndex : 2, 
borderWidth : 0.5, 
borderColor : "#dadada"} 

XML:

<Alloy> 
<TableViewRow id="row" onClick="openHistoryDetail"> 
    <View id="rowView" width="Ti.UI.FILL"> 
     <View id="contentView"> 
      <View id="leftView"> 
       <ImageView id="leftImage" /> 
      </View> 
      <View id="details" top="0"> 
       <View width="100%" height="Titanium.UI.SIZE" layout="horizontal"> 
        <View width="65%" layout="vertical"> 
         <Label id="topupCategory" class="mediumFont" text="" /> 
         <Label id="phone" class="smallFont" text="" /> 
         <Label id="date" class="smallFont" colocolor="#000" text="" /> 
        </View> 
        <View width="35%" layout="vertical" height="Ti.UI.SIZE> 
         <Label id="transfered_amount" class="amtBalance" text="" /> 
         <Label id="available_amount" class="mediumFont" text="" /> 
        </View> 
       </View> 
      </View> 
     </View> 
    </View> 
</TableViewRow> 

谢谢,