2013-03-30 41 views
1

我有一个视图,它是XML文档中的另一个视图。下面是与顶级的观点:无法样式嵌套Alloy视图

windowBase.xml:

<Alloy> 
    <Window class="base"> 

     <Window class="content"> 

      <Label class="haveActivation" text="Have an activation code for this device?"> 

     </Window> 
     <Require id="navigation1" class="navigation1" src="navigation" /> 

    </Window> 
</Alloy> 

,这里是该视图的风格:

windowBase.tss:

".navigation1": { 
    top: 692, 
    left: 100, 
    height: 265 
} 

".content": { 
    backgroundColor: "white", 
    height: 692, 
    top: 0 
} 

".haveActivation": { 
    bottom: 10 
} 

这里是子导航视图:

navigation.xml:

<Alloy> 
    <View class="nav" id="nav" onClick="nav_click"> 

     <Label class="tabExample" text="Tab here"> 

    </View> 
</Alloy> 

而对于导航视图样式:

navigation.tss:

"#nav": { 
    zIndex: 9999, 
    backgroundImage: "Navigation-Background.png", 
    width: 1024, 
    height: 265 
} 

".tabExample": { 
    color: "white" 
} 

".container": { 
    backgroundColor: "white" 
} 

你可以看到我有必要的查看(.navigation1)顶部样式设置为692.然而,当它显示时,它会将视图呈现在屏幕中间而不是底部。我能够将它渲染到顶端的唯一方法是:692是,如果我将该样式放置在导航视图的#nav样式中,这似乎没有多大意义。 我在做什么错?

回答

0

我不相信你可以在一个需求上放课。

将.navigation1类合并到navigation.xml中的nav id样式中,并删除navigation1类。无论如何,你的逻辑有点多余,通过尝试从包含文件的样式,你可能也会从包含文件本身的样式。

0

为了我的思维方式:

  1. 窗口不能包含.xml文件 其他窗口(JS可以创建一个新的窗口,打开它,或者在tabgroup)
  2. 窗口不能包括合金 .xml文件(需要.xml文件,您应该删除合金标签)