0
votes

I am new in Titanium and facing a problem with height of Tableviewrow in Alloy. My requirement is to set the height of Tableviewrow according to the content. I have tried a lot but did not get success. My History.xml code is:

<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>

and .tss file contains:

"#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"}

Any idea how can i set Tableviewrow height according to the content? Thanks in advance

1

1 Answers

0
votes

You should change according to below code:

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>

Thanks,