Fit自适应布局
Ext.layout.container.Fit是布局的基础类,对应面板配置项的名称为Fit,Fit布局将使唯一的子元素充满容器,如果当前容器中存在多个子面板则只有第一个会显示。
示例代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Ext.layout.container.Fit示例</title> <link href="ext-4.0.7-gpl/resources/css/ext-all.css" rel="stylesheet" type="text/css" /> <script src="ext-4.0.7-gpl/bootstrap.js" type="text/javascript"></script> <script type="text/javascript"> Ext.onReady(function () { Ext.create("Ext.panel.Panel", { title: "Ext.layout.container.Fit示例", frame: true, width: 300, height: 200, renderTo: Ext.getBody(), bodyPadding: 5, layout: "fit", defaults: { bodyStyle: "background-color:#FFFFFF" }, items: [{ title: "嵌套面板一", html: "面板一" }] }); }); </script> </head> <body> </body> </html>
效果图: