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

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 { }
<AutoFitText text="Testinggggggggggggggggg" textWrap="false"></AutoFitText>

原生 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 许可证第 2 版,2004 年 1 月