使用nativescript在stacklayout中居中显示带标签的文本
我想知道如何在堆栈布局中居中放置带有标签textwrap的文本 我试过使用horizontalAlignment=“center”,小文本也可以(例如:“hello”,“test test”),但如果我在标签上使用textWrap,它就不起作用了使用nativescript在stacklayout中居中显示带标签的文本,nativescript,nativescript-vue,Nativescript,Nativescript Vue,我想知道如何在堆栈布局中居中放置带有标签textwrap的文本 我试过使用horizontalAlignment=“center”,小文本也可以(例如:“hello”,“test test”),但如果我在标签上使用textWrap,它就不起作用了 <StackLayout v-for="(text, indexVerse) in texts" borderRadius="5" margin="5" padding="15" row="1" col="0" h
<StackLayout v-for="(text, indexVerse) in texts"
borderRadius="5" margin="5" padding="15" row="1" col="0" horizontalAlignment="center">
<Label textWrap="true"
:text="text.content"
color="#FFFFFF"
textAlign="center"
fontSize="20"/>
</StackLayout>
文本设置在左侧,不居中:
设置文本对齐方式的属性是
textAlignment
(如果其内联在模板上),如果通过css设置,则为文本对齐方式
尝试将textAlign
替换为textAlign
,如下所示:
完美!Thx@William!