Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10110] Android: view with borders are not correctly removed in scrollview

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-09-04T02:48:48.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sRelease 3.0.0
ComponentsAndroid
Labelsapi, module_scrollview, qe-review, qe-testadded, regression
ReporterMartin Guillon
AssigneeNeeraj Gupta
Created2012-07-20T01:23:30.000+0000
Updated2013-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);

Comments

  1. Martin Guillon 2012-07-20

    PS:why cant i add bugs to TIMOB? Thanks
  2. Martin Guillon 2012-07-23

    pull request awaiting https://github.com/appcelerator/titanium_mobile/pull/2619
  3. Martin Guillon 2012-07-23

    @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.
  4. Tamila Smolich 2012-08-14

    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.
  5. Neha Chhabra 2012-09-04

    Reopening to update labels
  6. jithinpv 2013-11-19

    anvil test case added PR Link: https://github.com/appcelerator/titanium_mobile/pull/4958

JSON Source