Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16629] Android: Adding a View/ImageView with Ti.UI.FILL width and height to ListView does not work

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Do
Resolution Date2020-01-09T22:17:40.000+0000
Affected Version/sRelease 3.2.2
Fix Version/sn/a
ComponentsAndroid
Labelsandroid
ReporterAnh Nguyen
AssigneeUnknown
Created2014-03-13T17:14:27.000+0000
Updated2020-01-09T22:17:40.000+0000

Description

Trying to Add one View with Indicator on ListView by using add() function //-------- CODE ----------------
var Wv = Ti.UI.createView({
    backgroundColor: 'yellow',
    width:Ti.UI.FILL,
    height:Ti.UI.FILL,
    //top:0,left:0,right:0,bottom:0,  //Try it but does not work
});


var style;
if (Ti.Platform.name === 'iPhone OS'){
  style = Ti.UI.iPhone.ActivityIndicatorStyle.DARK;
}
else {
  style = Ti.UI.ActivityIndicatorStyle.DARK;
}
var Indicator = Ti.UI.createActivityIndicator({
		color: 'black',		
		message: ' '+ 'Loading...Please wait...',
  style: style,
		
});
Wv.add(Indicator);

Indicator.show();

var ListView = Ti.UI.createListView({
    backgroundColor: 'white',
    width:Ti.UI.FILL,
    height:Ti.UI.FILL,
    //top:0,left:0,right:0,bottom:0,  
});

ListView.add(Wv);

var win = Ti.UI.currentWindow;

win.add(ListView);
//----------- END CODE ----------- The Wv View always shows at Position: (0,0), and does not fill out on ListView. It works on iPhone/iOS Simulator and Device but It does not work on Android

Attachments

FileDateSize
Android.png2014-03-13T17:14:27.000+000082445
iOS .png2014-03-13T17:14:27.000+000016836
Screen Shot 2014-03-13 at 10.43.27 PM.png2014-03-14T05:43:56.000+000022834

Comments

  1. Ritu Agrawal 2014-03-14

    I was not able to run your code as it is so I modified it to run but I cannot reproduce the same behavior on iOS or Android platform. Can you please provide a complete but simple test case to reproduce this issue? I am attaching my screenshot for iOS platform that is different from yours.
  2. Anh Nguyen 2014-03-15

    Sorry Ritu, Just skip the Navigation Bar on the top of window. It's just another View that contains some button. I have edited my code to show indicator. The yellow View fills to both width and height as expected on iPhone. but it does not fill to fit width and height on Android.
  3. Ritu Agrawal 2014-03-17

    Moving this ticket to engineering as I can reproduce the issue with an updated test case. Note that if I add the view in the test case to window directly (instead of adding it to List View) then both iOS and Android behave same. So this issue is specific to ListView. Updated test case
       var Wv = Ti.UI.createView({
           backgroundColor: 'yellow',
           width:Ti.UI.FILL,
           height:Ti.UI.FILL,
           //top:0,left:0,right:0,bottom:0,  //Try it but does not work
       });
       
       var style;
       if (Ti.Platform.name === 'iPhone OS'){
         style = Ti.UI.iPhone.ActivityIndicatorStyle.DARK;
       }
       else {
         style = Ti.UI.ActivityIndicatorStyle.DARK;
       }
       var Indicator = Ti.UI.createActivityIndicator({
               color: 'black',     
               message: ' '+ 'Loading...Please wait...',
         style: style,         
       });
       
       Wv.add(Indicator);
        
       Indicator.show();
       
       var ListView = Ti.UI.createListView({
           backgroundColor: 'white',
           width:Ti.UI.FILL,
           height:Ti.UI.FILL,
           //top:0,left:0,right:0,bottom:0,  
       });
        
       ListView.add(Wv);
       
       var win = Ti.UI.createWindow();
       win.add(ListView);
       win.open();
       
  4. jithinpv 2014-09-04

    Issue reproduces Titanium SDK version 3.4.0 master, 3.2.2.GA Titanium Studio, build: 3.3.0.201407100905 Titanium Command-Line Interface CLI version 3.3.0, Android device : Motorola Moto G, Android version : 4.4.4 iOS simulator : iPhone Retina (3.5-inch), iOS 7.0.3
  5. Alan Hutton 2020-01-09

    This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.

JSON Source