钛:标签重叠问题 [英] Titanium : Label over lapping issue

查看:34
本文介绍了钛:标签重叠问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安卓版

我在表格行中有两个标签.我试图将这两个标签设置为垂直,但 firstLabel 与第二个标签重叠.由于 firstLabel 的高度是 "auto" 并且它包含动态文本,例如10 行,20 行.

I have two labels in a table row. I am trying to set these two label vertical but the firstLabel overlaps the second one. As firstLabel's height is "auto" and it contains dynamic text e.g. 10 lines , 20 line.

由于 firstLabel 的动态高度,我无法设置 secondLabel 的顶部,因此它会重叠.

Due to dynamic height of firstLabel I couldn't set secondLabel's top so it gets overlapped.

我已经尝试了 SO 和 Appcelerator 上可用的所有可能的解决方案,但找不到修复程序.

I've tried all possible solution available on the SO and Appcelerator but couldn't find the fix.

1).在将 firstLabel 添加到视图、表格行等之前或之后,我无法获得它的高度...

1). I couldn't get height of firstLabel after or before adding it to the view, table's row etc...

2) 尝试 设置根据文本长度调整标签高度,但无法修复.

2) Tried to set height of label according to text's length but couldn't fix it .

仍在寻找解决方案..

Still looking for the solution..

推荐答案

您需要做的不是在标签上将布局设置为垂直,而是在包含所有标签的视图上.如果父视图有垂直布局,它会在第一个标签结束后立即放置第二个标签.另外,设置第二个标签的top"属性会在标签 1 的底部和标签 2 的顶部之间放置那么多单位.想想 CSS 中块元素的相对定位.

What you'll need to do is not to set the layout to vertical on the label, but rather on the view that is containing all the labels. If the parent view has a vertical layout, it will place the second label immediately after the first label ends. Additionally, setting the "top" property of the second label will place that many units between the bottom of label1 and top of label 2. Think relative positioning of block elements in CSS.

这篇关于钛:标签重叠问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆