简体   繁体   English

无法在右侧垂直对齐ExtJS按钮。

[英]Not able to align ExtJS buttons vertically on right.

I am using extjs and fabric canvas to generate the below panel,unfortunately I am not able to align all these buttons: 我正在使用extjs和fabric画布来生成下面的面板,不幸的是我无法对齐所有这些按钮: 在此处输入图片说明

vertically as in the picture below using just extjs: 垂直如下图所示,仅使用extjs: 在此处输入图片说明

Suggestions: 意见建议:

  1. you can set the width of all buttons equal and give equal left padding from the image. 您可以将所有按钮的宽度设置为相等,并从图像中给定相等的左填充。

  2. you can use left the vertical menu-bar and place the buttons in it and modify CSS to remove its border so that it can become invisible. 您可以使用垂直菜单栏的左侧并在其中放置按钮,然后修改CSS以删除其边框,使其变得不可见。

    you can make 2 vbox in items and in first place image and in second half place buttons. 您可以在项目,第一个图片和第二个下半部分按钮中创建2个vbox。

it's not looking good because of unequal width and space between buttons.for more help please provide code. 由于按钮之间的宽度和间距不相等,因此效果不佳。要获得更多帮助,请提供代码。

You need to use layout properties like vbox and hbox , here's the example: 您需要使用vboxhbox类的layout属性,下面是示例:

FIDDLE (press Run if image doesn't load properly) FIDDLE (如果图像无法正确加载,请按Run

Ext.create({
xtype: 'container',
layout: {
    type: 'hbox',
    align: 'stretch'
},

items: [{
    xtype: 'imagecomponent',
    width: 500,
    alt: 'img1',
    src: 'https://i.imgur.com/Y3GKYOF.png'
}, {
    xtype: 'container',
    layout: {
        type: 'vbox',
        align: 'stretch'
    },
    defaults: {
        margin: 5
    },
    items: [{
        xtype: 'button',
        text: 'Circle'
    }, {
        xtype: 'button',
        text: 'Box'
    }, {
        xtype: 'button',
        text: 'Arrow'
    }, {
        xtype: 'button',
        text: 'TextBox'
    }, {
        xtype: 'button',
        text: 'TextArea'
    }, {
        xtype: 'button',
        text: 'Delete'
    }, {
        xtype: 'button',
        text: 'Save'
    }]
}],
renderTo: Ext.getBody()
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM