Titanium 查看钛合金中的TSS

Titanium 查看钛合金中的TSS,titanium,titanium-mobile,titanium-alloy,Titanium,Titanium Mobile,Titanium Alloy,嗨,我是钛的新手,我不知道如何用它的TSS来创造流体设计。如何放置三个视图,一个作为页眉(20%),两个作为内容持有者(60%)和三个作为页脚(20%),并且全宽(Ti.UI.FILL)。我的密码是 index.xml <Alloy> <Window class="container"> <Require src="home" id="home"></Require> </Window> </Alloy&

嗨,我是钛的新手,我不知道如何用它的TSS来创造流体设计。如何放置三个视图,一个作为页眉(20%),两个作为内容持有者(60%)和三个作为页脚(20%),并且全宽(Ti.UI.FILL)。我的密码是

index.xml

<Alloy>
   <Window class="container">
       <Require src="home" id="home"></Require>
   </Window>
</Alloy>
<Alloy>
    <View id="header"></View>
    <View id="content"></View>
    <View id="footer"></View>
</Alloy>
<Alloy>
<View id="home">
    <View id="header" visible="true">
        <Label>header</Label>
    </View>
    <ScrollView id="content" visible="true">
        <Label>content</Label>
    </ScrollView>
    <View id="footer" visible="true">
        <Label>footer</Label>
    </View>
</View>
</Alloy>
<Alloy>
<Window class="container">
    <Require src="home" id="home"></Require>
</Window>
</Alloy>
我尝试的是在页眉视图内容视图以及页脚视图中放置后退按钮(左)、标题按钮(中)和刷新按钮(右)作为水平布局,并在内容视图页脚视图中设置滚动选项(即,我们可以通过在其上放置选项来使用幻灯片事件进行滚动)。如果我运行此代码,则视图最终会按相同方式划分,并且60%不会影响内容视图。我已经在appcelerator论坛上问过了,力还没有得到回复。希望这有帮助。

把这个放在:

"#home": {
    layout: 'vertical',
    width: Ti.UI.FILL,
    height: Ti.UI.FILL,
    backgroundColor: '#000'
},
index.tss
内,home.xml内没有id为
home
的元素,但index.xml内有一个元素。

请将此放在:

"#home": {
    layout: 'vertical',
    width: Ti.UI.FILL,
    height: Ti.UI.FILL,
    backgroundColor: '#000'
},

在home.xml中没有id为home的元素,但是在index.xml中有一个元素。

id为“home”的对象实际上不是视图,它只是对home类的引用,因此不能像这样将样式属性化给它

我会将relaid home.xml如下所示:

<Alloy>
    <View id="homeHolder">
        <View id="header"></View>
        <View id="content"></View>
        <View id="footer"></View>
    </View>
</Alloy>

id为“home”的对象实际上不是视图,它只是对home类的引用,因此不能像这样将样式属性化

我会将relaid home.xml如下所示:

<Alloy>
    <View id="homeHolder">
        <View id="header"></View>
        <View id="content"></View>
        <View id="footer"></View>
    </View>
</Alloy>

home.xml

<Alloy>
   <Window class="container">
       <Require src="home" id="home"></Require>
   </Window>
</Alloy>
<Alloy>
    <View id="header"></View>
    <View id="content"></View>
    <View id="footer"></View>
</Alloy>
<Alloy>
<View id="home">
    <View id="header" visible="true">
        <Label>header</Label>
    </View>
    <ScrollView id="content" visible="true">
        <Label>content</Label>
    </ScrollView>
    <View id="footer" visible="true">
        <Label>footer</Label>
    </View>
</View>
</Alloy>
<Alloy>
<Window class="container">
    <Require src="home" id="home"></Require>
</Window>
</Alloy>
index.xml

<Alloy>
   <Window class="container">
       <Require src="home" id="home"></Require>
   </Window>
</Alloy>
<Alloy>
    <View id="header"></View>
    <View id="content"></View>
    <View id="footer"></View>
</Alloy>
<Alloy>
<View id="home">
    <View id="header" visible="true">
        <Label>header</Label>
    </View>
    <ScrollView id="content" visible="true">
        <Label>content</Label>
    </ScrollView>
    <View id="footer" visible="true">
        <Label>footer</Label>
    </View>
</View>
</Alloy>
<Alloy>
<Window class="container">
    <Require src="home" id="home"></Require>
</Window>
</Alloy>


这很有效。感谢Martyn。

<Alloy>
   <Window class="container">
       <Require src="home" id="home"></Require>
   </Window>
</Alloy>
<Alloy>
    <View id="header"></View>
    <View id="content"></View>
    <View id="footer"></View>
</Alloy>
<Alloy>
<View id="home">
    <View id="header" visible="true">
        <Label>header</Label>
    </View>
    <ScrollView id="content" visible="true">
        <Label>content</Label>
    </ScrollView>
    <View id="footer" visible="true">
        <Label>footer</Label>
    </View>
</View>
</Alloy>
<Alloy>
<Window class="container">
    <Require src="home" id="home"></Require>
</Window>
</Alloy>
index.xml

<Alloy>
   <Window class="container">
       <Require src="home" id="home"></Require>
   </Window>
</Alloy>
<Alloy>
    <View id="header"></View>
    <View id="content"></View>
    <View id="footer"></View>
</Alloy>
<Alloy>
<View id="home">
    <View id="header" visible="true">
        <Label>header</Label>
    </View>
    <ScrollView id="content" visible="true">
        <Label>content</Label>
    </ScrollView>
    <View id="footer" visible="true">
        <Label>footer</Label>
    </View>
</View>
</Alloy>
<Alloy>
<Window class="container">
    <Require src="home" id="home"></Require>
</Window>
</Alloy>


这很有效。感谢Martyn。

感谢Josiah Hester-->如果我们提供页眉顶部:0英寸,页脚底部:0英寸,它工作正常。是的,这是一种方法,但如果你不纠正我指出的问题,以后会给你带来麻烦和困惑!做你所做的也意味着你会损失很多,因为你的
布局:垂直
没有使用。谢谢Josiah。对于index.xml,我们在xml(视图)中没有id作为索引,但如果我们调用$.index,它将调用索引视图。因此,我将id=home放在索引视图中,它将调用home视图。是否正确??感谢Josiah Hester-->如果我们提供页眉顶部:0英寸,页脚底部:0英寸,它工作正常。是的,这是一种方法,但如果您不纠正我指出的问题,它将在以后给您带来麻烦和混乱!做你所做的也意味着你会损失很多,因为你的
布局:垂直
没有使用。谢谢Josiah。对于index.xml,我们在xml(视图)中没有id作为索引,但如果我们调用$.index,它将调用索引视图。因此,我将id=home放在索引视图中,它将调用home视图。这是对的吗?太好了,它很有魅力。谢谢你,马丁。我不知道如何在注释中添加代码。我会把它作为其他人可以接受的下一个答案。很好,它就像魅力一样有效。谢谢你,马丁。我不知道如何在注释中添加代码。我将把它作为其他人可以接受的下一个答案。