Forum /
Sencha Touch 2.x Forums /
Sencha Touch 2.x: Q&A /
Answered: How to Apply Device Specific themes ( Android,iOs,BlackBerry ) in sencha touch?
Answered: How to Apply Device Specific themes ( Android,iOs,BlackBerry ) in sencha touch?
Hi All,
I want to apply device specific themes to my sencha touch application. Currently it is showing only the default theme (blue) as i've added sencha-touch.css file.
Can any one help me how to load device specific themes in my application?
Thanks.
Best Answer Posted by
janardhan pasumarthi
Hi All,
I've achieved this by checking Os name and loading the corresponding css file which is provided by sencha. Code looks like below:
if( Ext.os.is( OSNAME.BLACKBERRY ) ) {
loadCss( OSNAME.BLACKBERRY_CSS_URL ); // css url will be like
touch/resources/css/bb6.css
}
checked for all supporting OS similar to above one and rendering css with loadCss method. loadCss method code :
function loadCss(filename) {
var css = document.createElement('link');
css.rel = "stylesheet";
css.type = "text/css";
css.href = filename;
document.getElementsByTagName('head')[0].appendChild(css);
}
Hope this helps.
Thanks
Solved loading device specific css in sencha touch
Solved loading device specific css in sencha touch
Hi All,
I've achieved this by checking Os name and loading the corresponding css file which is provided by sencha. Code looks like below:
if( Ext.os.is( OSNAME.BLACKBERRY ) ) {
loadCss( OSNAME.BLACKBERRY_CSS_URL ); // css url will be like
touch/resources/css/bb6.css
}
checked for all supporting OS similar to above one and rendering css with loadCss method. loadCss method code :
function loadCss(filename) {
var css = document.createElement('link');
css.rel = "stylesheet";
css.type = "text/css";
css.href = filename;
document.getElementsByTagName('head')[0].appendChild(css);
}
Hope this helps.
Thanks
Now how can we do this using CMD while building for different devices, without having to manually adjust app.json each time?
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us