【问题标题】:Dynamic height of Tableviewrow in Titanium AlloyTableviewrow在钛合金中的动态高度
【发布时间】:2017-07-31 07:59:47
【问题描述】:

我是 Titanium 的新手,面临合金中 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 的高度吗?提前致谢

【问题讨论】:

    标签: titanium titanium-alloy


    【解决方案1】:

    您应该根据以下代码进行更改:

    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>
    

    谢谢,

    【讨论】:

      猜你喜欢
      • 2014-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多