[TIMOB-9333] Android: UI components do not respect positioning properties in "horizontal" layout
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-03-11T07:29:40.000+0000 |
Affected Version/s | Release 2.1.0, Release 2.0.1 |
Fix Version/s | Release 3.0.2 |
Components | Android |
Labels | core, ipass1 |
Reporter | Ivan Skugor |
Assignee | jithinpv |
Created | 2012-05-31T01:11:58.000+0000 |
Updated | 2017-03-17T18:47:35.000+0000 |
Tested on a Samsung Galaxy S2 running 2.3.6, issue reproducible on TiSDK 2.0.1GA2.
This bug is reported and tested for Android (I see that component part is set to iOS). Parity issue should be opened for iOS.
My mistake, accidentally selected iOS instead of Android. I only tested this on an Android device. Updated the ticket to reflect the correct platform.
Thanks. :)
I'm having a similar problem with vertical layouts - a set of textfields within a view are not respecting the bottom property. However, when I switch to using the top property to manage spacing between elements it works. Code snippet here. Switching to top worked to create a gap between text fields, using bottom didn't // Set up base view and UI elements var settingsView = Titanium.UI.createView({ width : Ti.UI.FILL, height : Ti.UI.FILL, top : 0, left : 0, backgroundColor : "#fff", }); var acctView = Titanium.UI.createView({ width : Ti.UI.FILL, height : Ti.UI.FILL, top : 10, left : 10, bottom : 10, right : 10, layout : "vertical", backgroundColor : "#ccc", borderRadius : 5, }); // Create userView elements var title = Ti.UI.createLabel({ width : Ti.UI.FILL, height : Ti.UI.SIZE, top : 8, left : 5, bottom : 8, text : "Signup" }); var titleSeperator = Ti.UI.createLabel({ width : Ti.UI.FILL, height : 2, backgroundColor : "#000", }); var userNameField = Titanium.UI.createTextField({ width : Ti.UI.FILL, height : Ti.UI.SIZE, left : 10, right : 10, top : 16, backgroundColor : "#FFF", borderWidth : 1, returnKeyType : Titanium.UI.RETURNKEY_DONE, hintText : "Enter your username", autocapitalization : Titanium.UI.TEXT_AUTOCAPITALIZATION_NONE, }); var userPassword = Titanium.UI.createTextField({ height : Ti.UI.SIZE, left : 10, right : 10, top : 16, backgroundColor : "#FFF", borderWidth : 1, returnKeyType : Titanium.UI.RETURNKEY_DONE, hintText : "Enter password", passwordMask : true, });
it is not a bug, change the width property of each component, you will get the expected result. try this code: (function() { var win = Ti.UI.createWindow({ backgroundColor: "#fff", navBarHidden: true, layout: 'horizontal' }); var label1 = Ti.UI.createLabel({ top: 150, left: 50, text: 'Testing 1 ...', height: '75dp', width: '25dp', backgroundColor: "#000" }); var textField = Ti.UI.createTextField({ top: 150, left: 50, height: '75dp', width: '25dp', }); var label2 = Ti.UI.createLabel({ top: 150, left: 50, text: 'Testing 2 ...', height: '75dp', width: '25dp', backgroundColor: "#000" }); var picker = Ti.UI.createPicker({ top: 150, left: 50, height: '75dp', width: '25dp', backgroundColor: "#999", selectionIndicator : true }); var data = []; data[0] = Ti.UI.createPickerRow({ title:'Bananas' }); data[1] = Ti.UI.createPickerRow({ title:'Strawberries' }); data[2] = Ti.UI.createPickerRow({ title:'Mangos' }); data[3] = Ti.UI.createPickerRow({ title:'Grapes' }); picker.add(data); win.add(label1); win.add(textField); win.add(label2); win.add(picker); win.open(); })(); Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 (03/11/13 15:43 0c88429) Titanium SDK version: 3.0.2 (02/07/13 16:46 a4def81) Device: Samsung galaxy s duos Android version: 4.0.4 Android Emulator: Android SDK version: 2.2
Closing ticket as invalid.