【问题标题】:Appcelerator: Label layout composite in View layout verticalAppcelerator:视图布局垂直中的标签布局复合
【发布时间】:2017-12-27 09:58:41
【问题描述】:

我需要在图像上方放置一个标签。此图像位于布局“垂直”的视图中,我需要此 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'
}

合金。 钛 SDKA:7.0.0.GA

【问题讨论】:

  • 你能展示你想要做什么的示例截图吗?

标签: layout appcelerator composite


【解决方案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>

【讨论】:

  • 谢谢普拉尚特!!。在问之前我应该​​考虑过这样做
猜你喜欢
  • 1970-01-01
  • 2014-07-03
  • 1970-01-01
  • 2015-03-04
  • 1970-01-01
  • 2012-02-15
  • 2014-10-07
  • 2012-10-25
  • 2018-07-28
相关资源
最近更新 更多