【问题标题】:center image in nativescriptnativescript中的中心图像
【发布时间】:2017-08-19 17:49:53
【问题描述】:

在尝试了 NativeScript 教程“Grocery”之后,我发现它的按钮很难点击,因为点击区域太小,所以我想通过将布局文件更新到以下来增加图像高度。但是,图像似乎不在中心(下图)。

如何在 NativeScript 中实现这一点?

list.html

<ActionBar title="Groceries">
    <ActionItem text="Share" (tap)="share()"
                android.systemIcon="ic_menu_share_holo_dark"
                ios.systemIcon="9" ios.position="right"></ActionItem>
</ActionBar>
<GridLayout rows="auto, *">

    <GridLayout row="0" columns="*, auto" class="add-bar">
        <TextField #groceryTextField [(ngModel)]="grocery" hint="Enter a grocery item" col="0"></TextField>
        <StackLayout class="delete-container" height="100%" (tap)="add()" col="1" >
            <Image src="res://add" stretch="none" horizontalAlignment="center"></Image>
        </StackLayout>
    </GridLayout>

    <ListView [items]="groceryList" row="1" class="small-spacing" [class.visible]="listLoaded">
        <ng-template let-item="item">
            <GridLayout columns="*, auto">
                <Label col="0" [text]="item.name" class="medium-spacing"></Label>
                <StackLayout col="1" class="delete-container" height="100%" (tap)="delete(item)">
                    <Image src="res://delete"></Image>
                </StackLayout>
            </GridLayout>
        </ng-template>
    </ListView>

    <ActivityIndicator
            [busy]="isLoading" [visibility]="isLoading ? 'visible' : 'collapse'"
            row="1" horizontalAlignment="center" verticalAlignment="center"></ActivityIndicator>

</GridLayout>

【问题讨论】:

    标签: nativescript nativescript-telerik-ui


    【解决方案1】:

    你应该看看 NS 的 FlexBox 布局。

    非常有用: http://docs.nativescript.org/cookbook/ui/layouts/flexbox-layout

    【讨论】:

      猜你喜欢
      • 2015-08-22
      • 1970-01-01
      • 2019-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-05
      相关资源
      最近更新 更多