Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24277] Android: ListView horizontal layout ignores 'right'

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-05-24T07:53:11.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsn/a
ReporterGary Mathews
AssigneeJoshua Quick
Created2017-01-05T14:51:32.000+0000
Updated2017-06-09T16:36:30.000+0000

Description

ListView items with layout: 'horizontal' do not display correctly. *TEST CASE*
var win = Ti.UI.createWindow(),
	items = [],
	template = {
		properties: {
			accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_NONE,
			backgroundColor: 'white',
			height: Ti.UI.SIZE,
			layout: 'horizontal'
		},
		events: {
			click: function(e) {
				alert(e.source.customProperty);
			}
		},
		childTemplates:
		[
			{
				type: 'Ti.UI.Button',
				bindId: 'bindButton',
				properties: {
					left: 10,
					width: 100,
					height: 40,
					borderRadius: 20,
					borderWidth: 1,
					borderColor: '#dedede',
					backgroundColor: 'green'
				},
			},
			{
				type : 'Ti.UI.Button',
				bindId : 'bindButton2',
				properties : {
					right: 10,
					width: 100,
					height: 40,
					borderRadius: 20,
					borderWidth: 1,
					borderColor: '#dedede',
					backgroundColor: 'red'
				}
			}
		]
	},
	listView = Ti.UI.createListView({templates: {'template': template}}),
	section = Ti.UI.createListSection();

for(var i = 1; i <= 10; i++){
	items.push({
		template: 'template',
		bindButton: {
		   title: 'button a ' + i,
		   customProperty: i
		},
		bindButton2: {
		   title: 'button b ' + i,
		   customProperty: i
		},
		properties: {
		   itemId: i
		}
	});
}

section.setItems(items);
listView.sections = [section];

win.add(listView);
win.open();
*EXPECTED* !ios.jpg|thumbnail! *ACTUAL* !android.jpg|thumbnail!

Attachments

FileDateSize
android.jpg2017-01-05T14:54:18.000+0000150410
ios.jpg2017-01-05T14:54:18.000+000087887

Comments

  1. Gary Mathews 2017-01-05

    master: https://github.com/appcelerator/titanium_mobile/pull/8730
  2. Samir Mohammed 2017-02-22

    Verified fixed in 6.1.0.v20170222102258. Test information available in https://github.com/appcelerator/titanium_mobile/pull/8730
  3. Dongwoo Gim 2017-05-22

  4. Dongwoo Gim 2017-05-22

  5. Dongwoo Gim 2017-05-22

    I send PR after solving this problem. https://github.com/appcelerator/titanium_mobile/pull/9073
  6. Dongwoo Gim 2017-05-22

    I send PR after solving this problem. https://github.com/appcelerator/titanium_mobile/pull/9073
  7. Eric Merriman 2017-05-22

    During test, please ensure you review AC-4976
  8. Joshua Quick 2017-05-23

    PR for 6.1.0: https://github.com/appcelerator/titanium_mobile/pull/9076
  9. Lokesh Choudhary 2017-05-24

    FR passed for backport PR.
  10. Lokesh Choudhary 2017-05-24

  11. Michael Gangolf 2017-06-07

    I think this patch broke this code:
        var win = Ti.UI.createWindow({
        	backgroundColor: '#000'
        });
        
        var view_content = Ti.UI.createView({
        	height: Ti.UI.SIZE,
        	width: Ti.UI.FILL,
        	layout: "horizontal"
        })
        
        for (var i = 0; i < 10; ++i) {
        	var dot = Ti.UI.createView({
        		borderColor: '#fff',
        		width: 6,
        		height: 6,
        		borderRadius: 3,
        		borderWidth: 1,
        		right: 3,
        		backgroundColor: (i == 0) ? "#fff" : "transparent"
        	});
        
        	view_content.add(dot);
        }
        
        
        win.add(view_content);
        win.open();
        
    with 6.0.4.GA it worked fine (displaying 10 circles). But in 6.1.0.GA I have to set left:0 now to get my circles to display. With just right:3 it won't work anymore
  12. Joshua Quick 2017-06-09

    For everyone's reference, the issue [~michael] mentioned is being handled in TIMOB-24792. [~michael], we plan on fixing this in v6.1.1 to be made available soon. Sorry about the inconvenience. We're adding more layout tests on our end to help avoid these issues in the future.
  13. Michael Gangolf 2017-06-09

    Thank you for the feedback! Since there is a workaround (setting the other position to 0) it can be fixed when updating (or I just wait for 6.1.1 :) ). Didn't spot that in the RC, so next time I'll do some more beta testing too!

JSON Source