Glance の相互運用性
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
場合によっては、XML と RemoteViews
を使用してビューを提供できます。
機能の実装時に Glance を使用せずに
現在の Glance API ではまだ利用できない、または実現できません。このような場合は
Glance には、相互運用 API である AndroidRemoteViews
が用意されています。
AndroidRemoteViews
コンポーザブルを使用すると、RemoteViews
をまとめて配置できます。
次のコンポーザブルに置き換えます。
val packageName = LocalContext.current.packageName
Column(modifier = GlanceModifier.fillMaxSize()) {
Text("Isn't that cool?")
AndroidRemoteViews(RemoteViews(packageName, R.layout.example_layout))
}
Glance を使用しない場合と同様に RemoteViews
を作成して定義し、次を渡します。
渡します。
さらに、コンポーザブルに RemoteViews
コンテナを作成することもできます。
AndroidRemoteViews(
remoteViews = RemoteViews(packageName, R.layout.my_container_view),
containerViewId = R.id.example_view
) {
Column(modifier = GlanceModifier.fillMaxSize()) {
Text("My title")
Text("Maybe a long content...")
}
}
この例では、「container」を含むレイアウトがが定義された
あります。このコンテナは ViewGroup
と同じ場所に配置されます。
できます。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2024-09-12 UTC。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"必要な情報がない"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"複雑すぎる / 手順が多すぎる"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"最新ではない"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻訳に関する問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"サンプル / コードに問題がある"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"その他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"わかりやすい"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"問題の解決に役立った"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"その他"
}]
{"lastModified": "\u6700\u7d42\u66f4\u65b0\u65e5 2024-09-12 UTC\u3002"}
[[["わかりやすい","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"]],["最終更新日 2024-09-12 UTC。"]]