Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-49] API - Titanium.UI.createButton (Android)

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:51:49.000+0000
Affected Version/sn/a
Fix Version/sRelease 0.6.0
ComponentsAndroid
Labelsandroid
ReporterDon Thorp
AssigneeDon Thorp
Created2011-04-15T02:23:03.000+0000
Updated2011-04-17T01:51:49.000+0000

Description

Description

The purpose of this API is to create a button native control. (Copied from iPhone ticket #22)

Example


var button = Titanium.UI.createButton({id:'foo',title:'My Title', icon:'images/foo.png'})


// add event listneer
button.addEventListener('click',function(event)
{
});

API Arguments

id : optional. HTML element id for where the button will be placed if placed in webview

title : optional. title text on button

icon : optional. path to image file

style : pre-defined button style

systemButton : pre-defined system icon or button (iPhone only)

width : optional. width of button

height : optional. height of button

backgroundImage : optional. path to a background image to be used as the background for the button

color : optional. text color

backgroundColor : optional. background color of field

Comments

  1. Don Thorp 2011-04-15

    Properties pulled from iPhone documentation. Not reflected in the spec.

    UI.Button.image : relative or app: path to the image that will appear if systemButton is not used

    UI.Button.backgroundDisabledImage : relative or app: path to the image that will appear as the stretchable background

    UI.Button.backgroundSelectedImage : relative or app: path to the image that will appear as the stretchable background if the button is not in the toolbar or navbar and is selected.

    UI.Button.borderColor : a web color of the corners behind the button. Default is transparent.

  2. Don Thorp 2011-04-15

    Pushed everything but the backgroundImage support. Also backgroundColor doesn't work quite as expected. Future work needs to be done to export state functionality to the api (e.g. focused, pressed, ...).

JSON Source