【问题标题】:Gridlayout on nativescript doesn't strech the componentsnativescript 中的 Gridlayout 不会拉伸组件
【发布时间】:2018-06-28 15:58:41
【问题描述】:

我正在尝试使 nativescript 上的网格布局工作,但我得到了这个结果:

这是我的 XML

<Page class="page" navigatingTo="onNavigatingTo" 
    xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true">

    <StackLayout class="p-5">
        <ScrollView>
            <StackLayout orientation="vertical">
                <GridLayout rows="*, *" columns="50%,40%,10%" width="100%" backgroundColor="#888">
                    <Label text="option" class="h2 m-y-auto" width="100%" textWrap="true" row="0" col="0" backgroundColor="#f00" />
                    <Label text="value" class="h2 text-primary m-y-auto" width="100%" row="0" col="1" backgroundColor="#0f0" />
                    <Button text="U" tap="{{openData}}" class="btn btn-primary btn-active p-0 m-0" width="100%" row="0" col="2" backgroundColor="#00f" />
                    <Button text="D" tap="{{openData}}" class="btn btn-primary btn-active p-0 m-0" width="100%" row="1" col="2" backgroundColor="#ff0" />
                </GridLayout>

            </StackLayout>
        </ScrollView>
    </StackLayout>
</Page>

谢谢!!!!!!

【问题讨论】:

  • 你的期望结果是什么?
  • 请添加游乐场演示

标签: android nativescript


【解决方案1】:

我在文档中找到了答案,谢谢!!

<GridLayout rows="*,*" columns="2*,2*,*" width="100%" backgroundColor="#888">
                <Label text="option" class="h2 m-y-auto" width="100%" textWrap="true" row="0" col="0" rowSpan="2" backgroundColor="#f00" />
                <Label text="value" class="h2 text-primary m-y-auto" width="100%" row="0" col="1" rowSpan="2" backgroundColor="#0f0" />
                <Button text="U" tap="{{openData}}" class="btn btn-primary btn-active p-0 m-0" width="100%" row="0" col="2" backgroundColor="#00f" />
                <Button text="D" tap="{{openData}}" class="btn btn-primary btn-active p-0 m-0" width="100%" row="1" col="2" backgroundColor="#ff0" />
            </GridLayout>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-25
    • 1970-01-01
    • 1970-01-01
    • 2014-03-23
    • 2020-06-03
    • 2018-01-24
    • 1970-01-01
    相关资源
    最近更新 更多