NativeScript-AutoFitText
AutoFitText NativeScript 插件。
npm i --save nativescript-auto-fit-text

AutoFitText

此插件基于 Nativescript Label 实现,但对字体大小进行了调整以适应其宽度。

Example Image

先决条件/要求

此插件仅在 {N} > 3.0.0 下进行了测试。

安装

描述您的插件安装步骤。理想情况下,它应该是这样的

tns plugin add nativescript-auto-fit-text

使用方法

Angular

import { AutoFitTextModule } from "nativescript-auto-fit-text/angular"

@NgModule({
...
imports: [
AutoFitTextModule
],
...
})
export class AppModule { }

纯 NativeScript

<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded" class="page" xmlns:ui="nativescript-auto-fit-text">
<StackLayout class="p-20">
<ui:AutoFitText text="Testinggggggggggggggggg" textWrap="false"></ui:AutoFitText>
</StackLayout>
</Page>

致谢

@grantland - android-autofittextview

许可证

Apache License 版本 2.0,2004 年 1 月