首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >NativeScript中的GridLayout显示不正确

NativeScript中的GridLayout显示不正确
EN

Stack Overflow用户
提问于 2019-06-10 03:01:12
回答 1查看 530关注 0票数 0

我的问题

我正在尝试在NativeScript中创建此屏幕:

我使用的是大家推荐的GridLayout。我严格按照文档进行操作(我想),结果如下:

如你所见,一点也不接近。下面是我的XML:

代码语言:javascript
复制
<Page
    navigatingTo="onNavigatingTo"  
    xmlns="http://schemas.nativescript.org/tns.xsd">

    <ActionBar class="action-bar customActionBar">
        <!-- 
        Use the NavigationButton as a side-drawer button in Android
        because ActionItems are shown on the right side of the ActionBar
        -->
        <NavigationButton ios:visibility="collapsed" icon="res://menu" tap="onDrawerButtonTap"></NavigationButton>
        <!-- 
        Use the ActionItem for IOS with position set to left. Using the
        NavigationButton as a side-drawer button in iOS is not possible,
        because its function is to always navigate back in the application.
        -->
        <ActionItem icon="res://navigation/menu" 
            android:visibility="collapsed" 
            tap="onDrawerButtonTap"
            ios.position="left">
        </ActionItem>
        <Label class="action-bar-title" text="Settings"></Label>
    </ActionBar>

    <GridLayout columns="2*, auto, auto" rows="75, auto, auto" width="100%" height="100%" backgroundColor="lightgray" >
    <Label text="Notifications" row="0" col="0"/>
    <Label text="Push" row="0" col="1" />
    <Label text="Email" row="0" col="2" />
<Label text="Messages" row="1" col="0"/>
<Switch checked="true" (checkedChange)="onCheckedChange($event)" class="m-15" row="1" col="1"></Switch>
 <Switch checked="true" (checkedChange)="onCheckedChange($event)" class="m-15" row="1" col="2"></Switch>
  </GridLayout>
</Page>

我试着摆弄数字,但它仍然不能像我所需要的那样显示。

我做错了什么。你能帮帮我吗?

谢谢。

约翰

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-06-10 05:11:11

看看像这样的东西

代码语言:javascript
复制
columns="4*, *, *"

得到你想要的。然后,您可以看到css为列添加填充和居中。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56517552

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档