如何创建从右到左的网格布局 nativescript

how to create right to left grid layout nativescript

我想在 nativescript 中创建一个从右到左的网格布局我搜索了一整天希望找到解决方案但我找不到任何所以这就是我想要的,考虑这个示例网格布局:

<GridLayout columns="*,*,*" rows="*,*,*,*,*"  sdkExampleTitle sdkToggleNavButton>
    <Button text="1" row="0" col="0" style="background-color: #0099CC; margin: 5;"></Button>
    <Button text="2" row="0" col="1" style="background-color: #FFFF66; margin: 5;"></Button>
    <Button text="3" row="0" col="2" style="background-color: #AA0078; margin: 5;"></Button>
    <Button text="4" row="1" col="0" style="background-color: #8C489F; margin: 5;"></Button>
    <Button text="5" row="1" col="1" style="background-color: #CCFFFF; margin: 5;"></Button>
    <Button text="6" row="1" col="2" style="background-color: #0099CC; margin: 5;"></Button>
</GridLayout>

如您所见,这是一个 2 行 3 列的网格布局

如上图所示,内容从左到右对齐。知道我想更改此布局以实现如下图所示的从右到左对齐,我如何使用 gridlayout 执行此操作我测试了水平对齐并将其设置为右对齐但它不起作用

GridLayout 是关于如何设置行/列的,要在屏幕截图中获得预期结果,您可能必须手动反转您分配的 col 值。

或者您可以使用 FlexboxLayout,这可能会得到相同的结果,但可能仍需要对样式进行细微调整。