[TIMOB-10110] Android: view with borders are not correctly removed in scrollview
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-09-04T02:48:48.000+0000 |
Affected Version/s | Release 2.1.0 |
Fix Version/s | Release 3.0.0 |
Components | Android |
Labels | api, module_scrollview, qe-review, qe-testadded, regression |
Reporter | Martin Guillon |
Assignee | Neeraj Gupta |
Created | 2012-07-20T01:23:30.000+0000 |
Updated | 2013-11-19T06:14:52.000+0000 |
Description
In android when you create a view with borders, two views are actually created to create the border.
The problem with this is that when trying to remove the view from a scrollview, you only remove the "container" view and not the border view.
The example
var win = Ti.UI.createWindow();
win.open();
var scrollView = Ti.UI.createScrollView({
contentHeight:'auto',
contentWidth:0,
layout:'horizontal',
backgroundColor: 'green'
});
win.add(scrollView);
var colors = ['red', 'blue', 'pink', 'white', 'black'];
var max = 120;
for(var i = 0; i < max; i++){
var view = Ti.UI.createView({
backgroundColor: colors[i%colors.length],
borderColor:'gray',
borderWidth:4,
height: 100,
left: 10,
width: 100,
top: 10
});
view.addEventListener('click', function(_event){
scrollView.remove(_event.source);
});
scrollView.add(view);
}
and here is a simple example of what should happen
var win = Ti.UI.createWindow({
backgroundColor:'white'
});
win.open();
var view = Ti.UI.createView({
backgroundColor: 'red',
borderColor:'gray',
borderWidth:4,
height: 200,
width: 200,
});
view.addEventListener('click', function(_event){
win.remove(view);
});
win.add(view);
PS:why cant i add bugs to TIMOB? Thanks
pull request awaiting https://github.com/appcelerator/titanium_mobile/pull/2619
@Shak Hossain: is there any way to have the right to create bugs in TIMOB? It would be much easier for me. Especially as actively develop on titanium mobile. Thanks. And thanks for looking at this.
Closing as fixed. Tested and verified on: Titanium Studio, build: 2.1.1.201208091713 Titanium SDK, build: 2.2.0.v20120813184911 Devices: Nexus 7 tab (4.1), HTC Evo (4.0.3), Android Emulator (2.2) The expected behavior is shown.
Reopening to update labels
anvil test case added PR Link: https://github.com/appcelerator/titanium_mobile/pull/4958