Alloy: Appearance of Ti.UI-Elements

You must Login before you can answer or comment on any questions.

Hey Guys,

I'm trying to create a simple To-Do-List App from scratch and I'm confused about the appearance of Ti.UI.-Elements.

Here is the setup:

Titanium SDK 2.1.3, Platform: iOS

addTodo.xml

<Alloy>
    <Window class="add">
        <View id="addView">
            <TextField id="name" />
        </View>
    </Window>
</Alloy>
addTodo.tss
"Window": {
    backgroundColor:"white",
    barColor: "#444",
},
".add": {
    title: L('add')
},
"#addView": {
    top: "5dp",
    left: "5dp",
    right: "5dp",
    bottom: "5dp",
    width: Ti.UI.FILL,
    height: Ti.UI.FILL,
    borderColor: "#444",
    borderRadius: 4,
    borderWidth: 1,
    layout: "vertical"
},
"#name": {
    top: "5dp",
    left: "5dp",
    right: "5dp",
    height: "50dp",
    width: Ti.UI.FILL,
    hintText: L('name')
}
If I start the iPhone Simulator it comes to the following output:

https://s3-eu-west-1.amazonaws.com/renekiel/alloy.png

The TextField is rendered without any borders or the well-know default style that comes along when developing in Titanium without Alloy.

2 Answers

you need to apply those style inside you .tss file, I do not see any set in the code you provided above

Ok, so I need to set

"#name": {
    [...]
    borderStyle:Ti.UI.INPUT_BORDERSTYLE_ROUNDED
}
for example?

And what about Ti.UI.TextArea or Ti.UI.Switch? Beside borderColor, borderRadius and borderWidth I can't set any more border-related style information like borderStyle.

— answered 8 months ago by René Bröcker
answer permalink
2 Comments
  • For Ti.UI.Switch I solved my problem:

    <Alloy>
        <Window class="add">
            <ScrollView id="addView">
                [...]
                <Switch id="active" />
                [...]
            </ScrollView>
        </Window>
    </Alloy>
    won't render a Switch (means the Switch is not displayed within the ScrollView), but
    <Alloy>
        <Window class="add">
            <ScrollView id="addView">
                [...]
                <Switch id="active" value="false"/>
                [...]
            </ScrollView>
        </Window>
    </Alloy>
    makes the Switch appear.

    But what about Ti.UI.Textarea?

    — commented 8 months ago by René Bröcker

  • you should use comments when responding to answers, it makes it easier to follow the thread.. BTW not sure I understand this question

    — commented 8 months ago by Aaron Saunders

Your Answer

Think you can help? Login to answer this question!