npm i --save @nativescript/auto-fit-text
- 版本:1.0.3
- GitHub:
- NPM: https://npmjs.net.cn/package/%40nativescript%2Fauto-fit-text
- 下载
- 昨日: 0
- 上周: 0
- 上个月: 0
@nativescript/auto-fit-text
ns plugin add @nativescript/auto-fit-text
此插件基于 Nativescript Label 实现,但对字体大小进行了调整以适应标签的宽度
使用方法
Nativescript
<Page
xmlns="http://schemas.nativescript.org/tns.xsd"
loaded="pageLoaded"
class="page"
xmlns:AFT="@nativescript/auto-fit-text"
>
<StackLayout class="p-20">
<AFT:AutoFitText
text="Testinggggggggggggggggg"
textWrap="false"
></AFT:AutoFitText>
</StackLayout>
</Page>
Angular NativeScript
import { NativeScriptAutoFitTextModule } from '@nativescript/auto-fit-text/angular';
// Be sure to add the plugin module to your NgModule
@NgModule({
imports: [NativeScriptAutoFitTextModule],
})
<AutoFitText row="2" fontSize="48" text="Lorem Ipsum this line of text with fontSize ignored because the text is so long." textWrap="false"></AutoFitText>
致谢
@grantland - android-autofittextview
许可证
Apache 许可证第 2 版,2004 年 1 月