android - Using Cordova, is there a way to reference native icons? -



android - Using Cordova, is there a way to reference native icons? -

i'm using cordova 3.5 build app contains menu pretty standard items in list (home, contacts, etc.), , want utilize native menu icons whenever possible. believe icons on device part of os, don't know if cordova gives me way reference them.

i suppose i'd need write javascript function take right file name based on platform, e.g.:

// pseudocode var icon = ''; if (platform === 'android') { icon = 'some/path/home.png'; } else { icon = 'other/path/icon.home.png'; // or maybe function such next exists: // icon = cordova.getnativeicon('icon.home.png'); } $('.selector').css('background-image', icon);

alternatively, may able create referencing files in css, e.g.:

.android .home-icon { background-image: url('some/path/home.png'); } .ios .home-icon { background-image: url('other/path/icon.home.png'); }

so, how folks handle sort of thing in cordova? there function can utilize access native icons? folks copying them projects? what's best practice?

if you're working cordova, you'll working within web view provided host os , won't have direct access artwork. i've found using icon fonts , css "themes" work enough, approach replicate artwork provided. there's work involved theming ios 6 vs ios 7 or 8, example, it's not bad sounds.

ibm have article on partitioning view between native , web controls, sounds bit cumbersome. more details here: https://www.ibm.com/developerworks/community/blogs/worklight/entry/ios_combining_native_and_web_controls_in_cordova_based_applications

android ios cordova

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -