Appcelerator:标签布局复合在View布局垂直中

问题描述 投票:0回答:1

我需要在图像上方放置一个标签。这个图像在布局“垂直”的视图中,我需要这个LABEL将它放在图像的右上方,绝对是。我怎样才能做到这一点?

我的代码:

的index.html

`<Alloy>
        <View class="col col-2">
                            <ImageView id="images" class="img-thumbnail"  />
                            <Label id="name"></Label>
                            <Label id="price"></Label>
        </View>
</Alloy>
`

    app.tss

    ".col-2":{
        layout: 'vertical',
        width: '49.25%',
        height: Ti.UI.SIZE,
    }
   ".badge":{
    top:0,
    right:0,
    backgroundColor:'green',
    color:'white',
    layout:'composite'
}

合金。 TITANIUM SDKA:7.0.0.GA

layout appcelerator composite
1个回答
1
投票

如果要在图像上方的右上角显示标签以及该垂直布局中的其他视图,则可以将垂直布局包装在不同的视图中并在右上角显示图像,如下所示:

<Alloy>
    <View width="49.25%" height="Ti.UI.SIZE">

        <!-- now use full width on this view -->
        <View class="col col-2" width="Ti.UI.FILL">
            <ImageView id="images" class="img-thumbnail"  />
            <Label id="name"></Label>
            <Label id="price"></Label>
        </View>

        <Label text="Put your top-right label here" width="Ti.UI.SIZE" height="Ti.UI.SIZE" top="16" right="16" />
    </View>
</Alloy>
© www.soinside.com 2019 - 2024. All rights reserved.