3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ref: https://developer.amazon.com/ja/docs/alexa-presentation-language/apl-pager.html

  • firstItem -> itmes -> lastItemの順番で表示される(多分)
  • initialPage(0からはじまる)を使うことでスタート位置を調整可能。
  • navigationをforward-onlyにすると、一方通行にできる

sample

{
    "type": "APL",
    "version": "1.0",
    "theme": "dark",
    "import": [
        {
            "name": "alexa-layouts",
            "version": "1.0.0"
        }
    ],
    "resources": [],
    "styles": {},
    "layouts": {
        "cover": {
            "parameters": [{
                "type": "string",
                "name": "lead"
            }],
           "item": [
               {
                   "type": "Container",
                   "width": "100vw",
                   "height": "100vh",
                   "alignItems": "center",
                   "justifyContent": "center",
                   "items": [
                       {
                           "type": "Text",
                           "text": "${lead}"
                       }
                    ]
               }
            ] 
        },
        "myFirstLayout": {
            "parameters": [
                {
                    "name": "title",
                    "type": "string"
                },{
                    "name": "subTitle",
                    "type": "string"
                },{
                    "name": "imageUrl",
                    "type": "string"
                },{
                    "name": "hint",
                    "type": "string"
                }
            ],
            "item": [
                {
                    "type": "Container",
                    "direction": "row",
                    "alignItems": "center",
                    "justifyContent": "spaceBetween",
                    "height": "100vh",
                    "width": "100vw",
                    "items": [
                        {
                            "type": "Container",
                            "width": "50vw",
                            "alignItems": "center",
                            "justifyContent": "center",
                            "items": [
                                {
                                    "type": "Text",
                                    "text": "${title}",
                                    "fontSize": "100dp"
                                }, {
                                    "type": "Text",
                                    "text": "${subTitle}"
                                }
                            ]
                        }, {
                                "scale": "best-fill",
                                "width": "50vw",
                                "height": "100vh",
                                "type": "Image",
                                "source": "${imageUrl}"
                        }
                    ]
                }
            ]
        }
    },
    "mainTemplate": {
        "parameters": ["payload"],
        "items": [
            {
                "type": "Pager",
                "width": "100vw",
                "height": "100vh",
                "navigation": "forward-only",
                "initialPage": 0,
                "firstItem": [
                    {
                        "type": "cover",
                        "lead": "Welcome to the skill"
                    }
                ],
                "lastItem": [
                    {
                        "type": "cover",
                        "lead": "See you !"
                    }
                ],
                "items": [
                    {
                      "type": "myFirstLayout",
                      "title": "Hello",
                      "subTitle": "${payload.examplePayload.subTitle}",
                      "hint": "${payload.examplePayload.hint}",
                      "imageUrl": "${payload.examplePayload.imageUrl}"
                    },
                    {
                      "type": "myFirstLayout",
                      "title": "How are you?",
                      "subTitle": "${payload.examplePayload.subTitle}",
                      "hint": "${payload.examplePayload.hint}",
                      "imageUrl": "${payload.examplePayload.imageUrl}"
                    }
                ]
            }
        ]
    }
}

ネプリーグのトロッコアドベンチャーみたいなことも頑張ればできそう(適当)。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?