Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8251] Android: Switch - Switch do not auto size to fit in view

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2012-03-26T13:05:42.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sn/a
ComponentsAndroid
Labelsparity, qe-and031912, qe-nfc
ReporterWilson Luu
AssigneeMarshall Culpepper
Created2012-03-23T14:37:13.000+0000
Updated2017-03-09T23:23:42.000+0000

Description

Steps to reproduce: 1. Run code on iOS:
// Create a switch on a parent that is width and height constrained  
// See that the switch sizes itself accordingly 

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

var label = Ti.UI.createLabel({
	text: 'Pass if switches are...',
	top: 20,
	left: 10,
	height: Ti.UI.SIZE,
	width: Ti.UI.SIZE,
	color: 'black'
});

var view1 = Ti.UI.createView({
	height: 30,
	width: 60,
	top: 80,
	backgroundColor: 'green'
});

var sw1=Titanium.UI.createSwitch({
	value: true
});

var view2 = Ti.UI.createView({
	height: 50,
	width: 120,
	top: 140,
	backgroundColor: 'green'
});

var sw2=Titanium.UI.createSwitch({
	value: true,
	title:'Testing'
});

var view3 = Ti.UI.createView({
	height: 70,
	width: 180,
	top: 220,
	backgroundColor: 'green'
});

var sw3=Titanium.UI.createSwitch({
	value: true,
	title: 'Test'
});


view1.add(sw1);
view2.add(sw2);
view3.add(sw3);

win.add(view1);
win.add(view2);
win.add(view3);
win.add(label);

win.open();

Actual: Switch controls do not size to the view. See attachment. Expected: Switch controls should size to the view.

Attachments

FileDateSize
device-2012-03-23-153643.png2012-03-23T14:37:13.000+000037299

Comments

  1. Allen Yeung 2012-03-23

    The switch should not size to fit the view as the title of the bug says since it has size behavior. Although I'm not sure whether it's a bug that we don't make the switch big enough to fit the title (looks like this is an android only property).
  2. Opie Cyrus 2012-03-26

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

    Closing ticket as invalid.

JSON Source