Extjs4---absolute布局

本文介绍了一种ExtJS中的Absolute布局方式,该布局继承自Anchor布局,并通过增加X/Y坐标来实现子组件的精确位置控制。示例展示了如何创建一个包含多个输入框和标签的面板,并设置它们的具体位置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Absolute布局继承Ext.layout.container.Anchor布局方式,并增加了X/Y配置选项对子组件进行定位,Absolute布局的目的是为了扩展布局的属性,使得布局更容易使用。

Ext.application(
		{
			name:'absolute',
			launch:function(){
				Ext.create(
						'Ext.panel.Panel',
						{
							title:'absolut布局',
							width:500,
							height:300,
							//父容器的位置
							x:20,
							y:30,
							//设置布局为absolute
							layout:'absolute',
							renderTo:Ext.getBody(),
							items:[
							       {
							       	   //设置控件的位置
							    	   x: 10,         
							           y: 10,          
							           xtype:'label',         
							           text: 'Send:'    
							       },{
							    	   x: 80,          
							           y: 10,
							           name: 'to', 
							           xtype:'textfield',         
							           anchor:'90% '   
							       },{         
							            x: 10,          
							            y: 40,         
							            xtype:'label',         
							            text: 'Subject:'     
							        },{          
							            x: 80,         
							            y: 40,         
							            name: 'subject',
							            xtype:'textfield',           
							            anchor: '90% ' 
							        },{         
							            x:0,          
							            y: 80,         
							            xtype: 'textareafield',         
							            name: 'msg',          
							            anchor: '100% 100%' 
							        }
							]
						}
				)
			}
		}
)

效果图


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值