Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5989] Android: Button's image attribute behaves the same as the backgroundImage attribute

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2012-04-27T10:15:55.000+0000
Affected Version/sRelease 1.7.3, Release 1.7.5, Release 1.8.0
Fix Version/sRelease 2.1.0, Sprint 2012-08
ComponentsAndroid
Labelsapi, module_button, parity, qe-testadded, release-note-2.1.0
ReporterEduardo Gomez
AssigneePing Wang
Created2011-11-04T09:12:55.000+0000
Updated2012-07-10T16:01:09.000+0000

Description

Problem

The button's image attribute does not work as described in documentation "the image to display on the button to the left of the title". Image scales to fill the entire button background.

Titanium API - Image property

http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.Button-object

Tested on

Android Emulator v2.2 & Android LG Ally device v2.2.1

Repro sequence

var win1 = Titanium.UI.createWindow({  
    title:'Win 1',
    backgroundColor:'#fff'
});

var button = Titanium.UI.createButton({
	top: 60,
	title : 'Hello',
	width : '140',
	height : '40',
	//backgroundImage : 'button.png',
	image: 'button.png',
	//backgroundLeftCap:12,
	//backgroundTopCap:12,
	//textAlign: Titanium.UI.TEXT_ALIGNMENT_RIGHT
});

win1.add(button);

win1.open();

Associated HD ticket

APP-379158

Attachments

FileDateSize
Untitled.jpg2011-11-04T09:12:55.000+000018396

Comments

  1. Taazza GO 2011-12-10

    Folks any updates on this issue? This means that we cant create any buttons with images. We are having to upgrade to 1.7.X or 1.8.X due to blocking bugs and now UI is broken. Any status on this would be greatly appreciated.
  2. Kevin Whinnery 2011-12-16

    Is this a documentation bug for an iOS only feature, or would the Button's leftDrawable attribute potentially support this?
  3. Taazza GO 2011-12-16

    We believe it a bug.
  4. Arthur Evans 2012-01-10

    I believe this is a parity issue. As far as I can tell, Android treats image and backgroundImage the same way. Documenting the current behavior for now. Already marked as a parity issue so we can see if this can be addressed.
  5. Paul Hamilton 2012-04-02

    I see that this was scheduled to be fixed and then removed. Any update to this issue as to when/if it can be fixed?
  6. Allen Yeung 2012-05-10

    A modified test case is with the proper image and height:
       var win1 = Titanium.UI.createWindow({  
           title:'Win 1',
           backgroundColor:'#fff'
       });
        
       var button = Titanium.UI.createButton({
           top: 60,
           title : 'Hello',
           width : '180',
           height : '80',
           //backgroundImage : 'KS_nav_ui.png',
           image: 'KS_nav_ui.png',
       //    backgroundLeftCap:12,
       //    backgroundTopCap:12,
       //    textAlign: Titanium.UI.TEXT_ALIGNMENT_RIGHT
       });
        
       win1.add(button);
        
       win1.open();
       
  7. Tamila Smolich 2012-06-23

    Closing as fixed. Verified with: Titanium Studio, build: 2.1.0.201206221045 Titanium SDK: 2.1.0.v20120622174154 Device: Samsung Galaxy tab (3.2)

JSON Source