Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8245] Android: Button - Button will not auto resize to fit long text

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2012-03-26T13:05:16.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sn/a
ComponentsAndroid
Labelsparity, qe-and031912, qe-nfc
ReporterWilson Luu
AssigneeMarshall Culpepper
Created2012-03-23T13:02:52.000+0000
Updated2017-03-09T23:23:50.000+0000

Description

Steps to reproduce: 1. Run the following code:
// Create 3 button on a parent that is width and height constrained with the following text:
// A
// Test
// VeryLongButtonText1234567890 
// See that the button sizes itself accordingly

var win = Ti.UI.createWindow();
win.backgroundColor = 'white';

var label = Ti.UI.createLabel({
	text: 'Buttons should auto size to text, but stay within red',
	top: 20,
	left: 10,
	height: Ti.UI.SIZE,
	width: Ti.UI.SIZE,
	color: 'black'
});
// Short Test
var outlineView1 = Ti.UI.createView({
	height: 62,
	width: 152,
	top: 80,
	backgroundColor: 'red'
});
var view1 = Ti.UI.createView({
	height: 60,
	width: 150
});
var button1 = Ti.UI.createButton({
	title: 'A'
});
view1.add(button1);
outlineView1.add(view1);

// Medium Test
var outlineView2 = Ti.UI.createView({
	height: 62,
	width: 152,
	top: 180,
	backgroundColor: 'red'
});
var view2 = Ti.UI.createView({
	height: 60,
	width: 150
});
var button2 = Ti.UI.createButton({
	title: 'Test'
});
view2.add(button2);
outlineView2.add(view2);

// Long Test
var outlineView3 = Ti.UI.createView({
	height: 62,
	width: 152,
	top: 280,
	backgroundColor: 'red'
});
var view3 = Ti.UI.createView({
	height: 60,
	width: 150
});
var button3 = Ti.UI.createButton({
	title: 'VeryLongButtonText1234567890 '
});
view3.add(button3);
outlineView3.add(view3);


win.add(label);
win.add(outlineView1);
win.add(outlineView2);
win.add(outlineView3);

win.open();
Actual: The last button does not auto fit the long text. See attachment. Expected: The last button should auto fit the long text Note: * Above code works as expected on iOS.

Attachments

FileDateSize
device-2012-03-23-140417.png2012-03-23T13:04:46.000+000043556

Comments

  1. Tamila Smolich 2012-03-26

    Also occurs on: Titanium Studio, build: 2.0.0.201203262445 SDK: 2.0.0.v20120325213306 Device: Android Nexus S (2.3.6)
  2. Sitara Shylaja 2012-03-26

    This also occurs on Android(2.2.2) Nexus one when tested on Titanium mobilesdk-2.0.0.v20120325213306 Titanium Studio build: 2.0.0.201203262445
  3. Opie Cyrus 2012-03-26

    Android behavior is correct in this use case
  4. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source