Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2940] Android: Density-specific backgroundImage is being ignored

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2011-12-26T03:47:07.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsregression
ReporterPaul Semczuk
AssigneePaul Dowsett
Created2011-12-14T05:11:09.000+0000
Updated2016-03-08T07:47:56.000+0000

Description

I'm trying to use a backgroundImage property on several buttons and views, and have each as a set of density specific images (/Resources/android/images/res-*dpi/image.png) as well as a default /Resouces/images/image.png. In SDK 1.7.5 this works fine but if I use any version higher that this the density images are ignored and the default is always used.
var win = Titanium.UI.createWindow({
	backgroundColor: '#604040',
	layout: 'vertical'
});

var image = Ti.UI.createImageView({
	image: '/images/test.png',
	top: '20dp',
	width: '108dp',
	height: '84dp'
});

var button = Ti.UI.createButton({
	backgroundImage: '/images/test.png',
	top: '20dp',
	width: '108dp',
	height: '84dp'
});

var view = Ti.UI.createView({
	backgroundImage: '/images/test.png',
	top: '20dp',
	width: '108dp',
	height: '84dp'
});

win.add(image);
win.add(button);
win.add(view);

win.open();
Running the attached project (above) on 1.7.5 shows me the same 3 *DPI images as expected, but anything above that shows the top image properly (it uses an image property), and the bottom 2 show the 'default' image (these use backgroundImage). I don't think I'm doing anything special, and I've tried every combination of OS, Javascript runtime, Android SDK, Ti SDK, emulator size, fastdev etc I can think of. The earliest CI build I've tried is 1.7.6.v2011120913042, also 1.8.0.1.RC1 and many 1.8/1.9 CI builds up to 1.9.0.v20111214004742.

Attachments

FileDateSize
1.7.5.jpg2011-12-14T05:11:09.000+0000127462
1.7.6.and.up.jpg2011-12-14T05:11:09.000+0000127380
test.zip2011-12-14T05:11:09.000+000039935

Comments

  1. Paul Dowsett 2011-12-26

    Paul Thank you for raising this ticket, particularly as it is so well-formed. When using platform-specific folders, I don't think the /images/ folder is necessary, and removing it will resolve the issue (it does in my tests). Search for the term "default folder" in [Using density-specific resources on Android](https://wiki.appcelerator.org/display/guides/Using+density-specific+resources+on+Android). I will close this for now. Please reopen the ticket if this does not resolve it for you. If you do, please state the exact screens that you have tested. Cheers
  2. Paul Dowsett 2012-02-17

    Closing due to inactivity. If this issue still exists, please raise a new ticket, including all the information in the [JIRA Ticket Checklist](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist) to ensure that we can escalate it quickly. Read [How to Submit a Bug Report](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report) if you have not read it before, and always start a ticket using the [JIRA Ticket Template](https://wiki.appcelerator.org/display/guides/JIRA+Ticket+Template). Thanks in advance
  3. Remko Posthuma 2012-03-06

    Please re-open this doesn't work in 1.8.2 to

JSON Source