Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3658] Android - Wrong view size

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2016-05-29T10:15:55.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy, Titanium SDK & CLI
Labelsandroid-4.4
ReporterAnna
AssigneeShak Hossain
Created2016-05-25T11:06:26.000+0000
Updated2016-05-29T10:15:55.000+0000

Description

I have a view named "pie" and I set a height, but when I get his height after postlayout event this value is different. Test device: Android 4.4 Samsung Core 2 controller.xml
<View id="board">
  <View id="pie"></View>
</View>
controller.tss
"#pie":{
    height: 47
}
controller.js
$.board.addEventListener('postlayout', function(e){
    Ti.API.info("## Pie height: " + $.pie.size.height);
});
Log: "## Pie height: 5"

Comments

  1. Nazmus Salahin 2016-05-25

    Hello [~amurcia], Thanks for reaching out. To identify the cause of the issue we need to reproduce it. For that please provide full test code that we can run and reproduce the issue. Once the problem is identified we will be able to give you solution. Regards
  2. Anna 2016-05-25

    You have the test code in the description
  3. Nazmus Salahin 2016-05-25

    Hello [~amurcia], The code you provided seems to be part of a full project. I was wondering if the view has parent or not. Please let us know if the given code reproduces the issue or something else is needed to add. Thanks for your co-operation
  4. Nazmus Salahin 2016-05-26

    Hello, I have tested the issue in my environment and found that view.size.height gives correct result. Here is my log for the following code. *Log:*
       [INFO] :   ## Pie height: 47
       [INFO] :   ## Pie height: 47
       
    *index.xml:*
       <Alloy>
       	<Window class="container">
       		<View id="board">
       			 <View id="pie"></View>
       		</View>
       	</Window>
       </Alloy>
       
    *index.js:*
       $.board.addEventListener('postlayout', function(e){
       
           Ti.API.info("## Pie height: " + $.pie.size.height);
       
       });
       
       
       $.index.open();
       
    *index.tss:*
       ".container": {
       	backgroundColor:"white"
       }
       
       "#pie":{
       
           height: 47
       
       }
       
    *Environment*: *Device info:* Nexus7 (android 6.0.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDKs:* 5.2.2.GA and 5.4.0.v20160509133737 *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.5 *Appcelerator CLI Version:* 5.2.2 *Appcelerator Studio:* 4.5.0

JSON Source