This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
构建主屏幕
在本章中,指导你的AI代理添加标签导航、照片查看器和图片选择器。
在本章中,应用开始看起来像 StickerSmash:两个导航标签页、一个照片浏览器,以及一个打开手机照片库的按钮。
🌐 In this chapter, the app starts to look like StickerSmash: two navigation tabs, a photo viewer, and a button that opens your phone's photo library.
1
2
添加照片查看器
🌐 Add the photo viewer
接下来,为主屏幕提供其主要内容:一张大照片和两个按钮。我们已经准备好了一个包含占位照片和你稍后使用的表情贴纸的素材包。将以下提示粘贴到你的代理中:
🌐 Next, give the home screen its main content: a large photo and two buttons. We've prepared an asset pack with the placeholder photo and the emoji stickers you'll use later. Paste the following prompt into your agent:
想自己下载资源吗?
如果你的代理无法下载或解压文件,请手动操作:下载 sticker-smash-assets.zip,解压它,然后将图片复制到你的 StickerSmash 文件夹内的 assets/images 文件夹中,替换同名文件。然后请代理根据上面的提示构建屏幕,但去掉提示的第一句。
🌐 If your agent can't download or extract the file, do it manually: download sticker-smash-assets.zip, unzip it, and copy the images into the assets/images folder inside your StickerSmash folder, replacing files with the same names. Then ask the agent to build the screen with the prompt above, minus its first sentence.
你应该看到的内容:一张几乎填满整个屏幕的木质栈道横跨海洋的照片,下面有两个按钮:
3
如果结果与你预期的不符,请告诉代理你看到的内容。上一章的当某些东西看起来不对时部分有操作手册。
概括
🌐 Summary
Chapter 3: Build the home screen
The app now has navigation, a styled home screen, and a working photo picker. You haven't touched a line of code.
In the next chapter, you'll add an emoji picker modal and play with the sticker using gestures.