2014-08-28 43 views
0

我为我想在我的钛应用程序中重复使用的按钮创建了一个控制器。我在我的一个窗口中使用createController并将其添加到窗口中。到现在为止还挺好。钛控制器有一个高度,我似乎无法控制

但是,按钮似乎有一个完整的窗口值得高度,我找不到方法来改变这一点。我错过了什么?下面我的文件:

view button.xml

<Alloy> 
    <View id="generalButtonContainer"> 
     <View id="generalButton" class="generalButton" onClick="callback" > 
      <Label class="generalButtonLabel" id="generalButtonLabel" /> 
      <ImageView class="generalButtonIcon" /> 
     </View> 
    </View> 
</Alloy> 

button.tss

".generalButton": { 
    height: 60, 
    borderRadius: 2, 
    backgroundColor: '#5ba7e6', 
    left: 10, 
    right: 10 
} 

".generalButtonLabel": { 
    color: '#ffffff', 
    font: { 
     fontSize: 16 
    }, 
    left: 15 
} 


".generalButtonIcon": { 
    image: '/images/generic/arrow-thin-right-white.png', 
    height: 15, 
    width: 15, 
    top: 22, 
    right: 15 
} 
"#generalButtonContainer": { 
    width: 320, 
    height: Ti.UI.SIZE 
} 

在这里,我包括在我的父窗口

Alloy.createController('button',{text: 'signup.button.continue'}); 
$.signupButtonContainer.add(buttonView.getView()); 

而现在,即使我指定身高,(也在signupButtonContainer的父窗口:Ti.UI.SIZE)我仍然可以看到整个窗口的高度。

我该如何解决这个问题?

编辑:如果有任何信息,你错过了,只是问!包含大量信息的复杂问题

回答

1

我没有看到任何明显的问题。调试这些布局问题可能涉及一些试验和错误。我会建议两种策略。

1)检查资源生成的代码/ 平台 /铝合金/控制器/ 控制器 .js文件,看是否有明显的东西在那里。请记住没有显式值的组件的各种布局组件的默认高度/宽度。

2)我建议您使用LiveView或TiShadow,以便您可以快速查看布局更改。然后,开始将各种元素的背景颜色设置为明显的颜色(如粉红色,橙色,绿色等的字符串很好地工作),以查看哪些元素正在填充屏幕。

相关问题