Sencha Touch - 主题
Sencha Touch 提供了许多主题供您在应用程序中使用。您可以添加不同的主题来代替经典主题,并根据我们为应用程序使用的设备查看输出的差异。只需替换主题 CSS 文件即可完成此操作,如以下示例中所述。
桌面主题
考虑您的第一个 Hello World 应用程序。应用程序中的以下 CSS 用于桌面主题。
https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css
要查看效果,请尝试以下程序 −
<!DOCTYPE html> <html> <head> <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" /> <script type="text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script> <script type = "text/javascript"> Ext.application({ name: 'Sencha', launch: function() { Ext.create("Ext.tab.Panel", { fullscreen: true, items: [{ title: 'Home', iconCls: 'home', html: 'Welcome to sencha touch' }] }); } }); </script> </head> </html>
这将产生以下结果 −
Windows 主题
考虑您的第一个 Hello World 应用程序。从应用程序中删除以下 CSS −
https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css
添加以下 CSS 以使用 Windows 主题。
https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/wp.css
要查看效果,请尝试以下程序 −
<!DOCTYPE html> <html> <head> <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/wp.css" rel = "stylesheet" /> <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script> <script type = "text/javascript"> Ext.application({ name: 'Sencha', launch: function() { Ext.create("Ext.tab.Panel", { fullscreen: true, items: [{ title: 'Home', iconCls: 'home', html: 'Welcome to sencha touch' }] }); } }); </script> </head> </html>
这将产生以下结果 −
IOS 主题
考虑您的第一个 Hello World 应用程序。从应用程序中删除以下 CSS。
https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css
添加以下 CSS 以使用 Windows 主题
https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/cupertino.css
要查看效果,请尝试以下程序 −
<!DOCTYPE html> <html> <head> <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/cupertino.css" rel = "stylesheet" /> <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script> <script type = "text/javascript"> Ext.application({ name: 'Sencha', launch: function() { Ext.create("Ext.tab.Panel", { fullscreen: true, items: [{ title: 'Home', iconCls: 'home', html: 'Welcome to sencha touch' }] }); } }); </script> </head> </html>
这将产生以下结果 −
IOS 经典主题
考虑您的第一个 Hello World 应用程序。从应用程序中删除以下 CSS −
https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css
添加以下 CSS 以使用 Windows 主题 −
https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/cupertino-classic.css
要查看效果,请尝试以下程序 −
<!DOCTYPE html> <html> <head> <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/cupertino-classic.css" rel = "stylesheet" /> <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script> <script type = "text/javascript"> Ext.application({ name: 'Sencha', launch: function() { Ext.create("Ext.tab.Panel", { fullscreen: true, items: [{ title: 'Home', iconCls: 'home', html: 'Welcome to sencha touch' }] }); } }); </script> </head> </html>
这将产生以下结果 −
Android 主题
考虑您的第一个 Hello World 应用程序。从应用程序中删除以下 CSS。
https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css
添加以下 CSS 以使用 Windows 主题。
https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/mountainview.css
要查看效果,请尝试以下程序 −
<!DOCTYPE html> <html> <head> <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/mountainview.css" rel = "stylesheet" /> <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script> <script type = "text/javascript"> Ext.application({ name: 'Sencha', launch: function() { Ext.create("Ext.tab.Panel", { fullscreen: true, items: [{ title: 'Home', iconCls: 'home', html: 'Welcome to sencha touch' }] }); } }); </script> </head> </html>
这将产生以下结果 −
BlackBerry 主题
考虑您的第一个 Hello World 应用程序。从应用程序中删除以下 CSS。
https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css
添加以下 CSS 以使用 Windows 主题。
https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/bb10.css
要查看效果,请尝试以下程序 −
<!DOCTYPE html> <html> <head> <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/bb10.css" rel = "stylesheet" /> <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script> <script type = "text/javascript"> Ext.application({ name: 'Sencha', launch: function() { Ext.create("Ext.tab.Panel", { fullscreen: true, items: [{ title: 'Home', iconCls: 'home', html: 'Welcome to sencha touch' }] }); } }); </script> </head> </html>
这将产生以下结果 −