Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
建立開始畫面
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如要建立應用程式顯示的畫面,請定義擴充 Screen 類別的類別,並實作其 onGetTemplate 方法,傳回代表要在車輛螢幕上顯示的 UI 狀態的 Template 執行個體。
下列程式碼片段說明如何宣告使用 PaneTemplate 範本的 Screen,顯示「Hello world!」字串:
class MyStartScreen(carContext: CarContext) : Screen(carContext) {
override fun onGetTemplate(): Template {
val row = Row.Builder().setTitle("Hello world!").build()
val pane = Pane.Builder().addRow(row).build()
val header = Header.Builder()
.setStartHeaderAction(Action.APP_ICON)
.build()
return PaneTemplate.Builder(pane)
.setHeader(header)
.build()
}
}
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2026-05-11 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2026-05-11 (世界標準時間)。"],[],[]]