Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用nativescript在stacklayout中居中显示带标签的文本_Nativescript_Nativescript Vue - Fatal编程技术网

使用nativescript在stacklayout中居中显示带标签的文本

使用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

我想知道如何在堆栈布局中居中放置带有标签textwrap的文本

我试过使用horizontalAlignment=“center”,小文本也可以(例如:“hello”,“test test”),但如果我在标签上使用textWrap,它就不起作用了

<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!