[英]Android and iOS Label line count Angular/Nativescript
I'm relatively new to Angular/Native/Mobile dev.我对 Angular/Native/Mobile 开发比较陌生。 I need to figure out the line count on a Label element, after it has been rendered on the screen.
在 Label元素在屏幕上呈现后,我需要计算它的行数。 I have been trying to find a solution online for a while now, with no result - maybe I'm searching for the wrong stuff?
一段时间以来,我一直试图在网上找到解决方案,但没有结果 - 也许我正在寻找错误的东西? I really expected that would have already been implemented as part of Label/UILabel, I don't know, I'm lost.
我真的希望它已经作为 Label/UILabel 的一部分实现了,我不知道,我迷路了。 Any ideas would be greatly appreciated.
任何想法将不胜感激。 Thanks!
谢谢!
After giving the documentation another look, I figured it out.再看一遍文档后,我想通了。 Nativescript's Label is based onAndroid's TextView , there is, of course, an implementation for line count - to get it, just use getLineCount() .
Nativescript 的 Label 是基于Android 的 TextView ,当然,有一个行数的实现 - 要获得它,只需使用 getLineCount() 。 Can't believe I missed that before.
不敢相信我以前错过了。 Thought I'd post the answer anyway, for anyone else, who's great at overlooking obvious things, like me.
我想无论如何我都会发布答案,对于像我这样擅长忽略明显事物的其他人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.