Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10396] TiAPI: 9-patch workflow enhancements

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 2.1.1
Fix Version/sn/a
ComponentsAndroid
Labelscommunity, core
ReporterEsben Maaløe
AssigneeUnknown
Created2012-08-06T08:51:56.000+0000
Updated2018-02-28T20:03:19.000+0000

Description

backgroundImage : 'test.png' Android will look for the image. If it can't find it, it will look for 'test.9.png' I suggest the opposite Android first looks for test.9.png, if it can't find it, it will look for 'test.png' That way you don't need any branching code in your app if you are writing for Android and iOS simultaneously Instead of: backgroundImage : Ti.Platform.osname == 'android' ? 'test.png' : 'test_ios.png' you could simply go: backgroundImage : 'test.png' Here is some testcode. Copy the attached images to the root of Resources/ - then build. You'll clearly see that Android is using 'test.png' stretched raw, rather than using 'test.9.png'. Then delete or rename test.png, and build again (you may or may not need to clean project) and build again - now it works. ~~~ var win = Ti.UI.createWindow( { backgroundColor : 'white', exitOnClose : true, fullscreen : false, title : 'Click button to test' }); var button = Ti.UI.createButton( { backgroundImage : '/test.png', backgroundSelectedImage : '/test.png', title : 'Click me!', top : 10, width : 300, height : 200 }); button.addEventListener('click', function(e) { Ti.API.info("You clicked the button"); }); win.add(button); win.open() ~~~

Attachments

FileDateSize
test.9.png2012-08-06T08:51:56.000+0000348
test.png2012-08-06T08:51:56.000+0000352

Comments

No comments

JSON Source