Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: updated anchor link

Excerpt

Demonstrates how to structure an Alloy project with folders that contains platform-specific views.

Info
titleApp folder location

alloy/test/apps/advanced/platform_folders

You can define platform-specific resources in an Alloy project, including controllers, views and styles. Simply create a folder named android or ios inside the app/controllers, app/views, or app/styles folders, and add your platform specific files. The sample application uses this feature to display a scrollable list of images using CoverFlowView component for iOS builds, and a ScrollView for other platform builds.

The project structure looks as follows:

Code Block
titleApp views folder
app/views/
├──index.xml
└──ios
   └──index.xml

The views/index.xml file includes a ScrollView element:

Code Block
titleapp/views/index.xml
linenumberstrue
languagexml
<Alloy>
    <Window>
        <ScrollView id="scroll" layout="vertical">
            <ImageView image="/appc1.png"/>
            <ImageView image="/appc2.png"/>
            <ImageView image="/appc3.png"/>
            <ImageView image="/appc4.png"/>
        </ScrollView>
    </Window>
</Alloy>

And the views/ios/index.xml file includes the CoverFlowView component.

Code Block
titleapp/views/ios/index.xml
linenumberstrue
languagexml
<Alloy>
    <Window>
        <CoverFlowView id="coverflow"/>
        <Label id="apilabel">Ti.UI.iOS.CoverFlowView</Label>
    </Window>
</Alloy>

See also