久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      谷歌發(fā)布 Jetpack Glance Alpha 版,構(gòu)建安卓 12 小組件更輕松

        12 月 28 日消息,據(jù)谷歌開(kāi)發(fā)者發(fā)布,Android 12 改進(jìn)了一項(xiàng)被許多 Android 用戶視為關(guān)鍵的功能 – App Widgets,改進(jìn)后的 Widgets 更加實(shí)用、美觀,且更易于被用戶發(fā)現(xiàn) (84% 的用戶至少使用一個(gè) Widgets)?,F(xiàn)在,我們發(fā)布了 Jetpack Glance 的第一個(gè) Alpha 版,讓 Widgets 的構(gòu)建過(guò)程變得更加輕松,該版本是建立在 Jetpack Compose 運(yùn)行時(shí) (Runtime) 之上的新框架,旨在實(shí)現(xiàn)更快、更輕松的為主屏幕或其他界面構(gòu)建 App Widgets。

      谷歌發(fā)布 Jetpack Glance Alpha 版,構(gòu)建安卓 12 小組件更輕松

            Android 12 Widgets 改進(jìn)

        https://developer.android.google.cn/about/versions/12/features/widgets

        App Widgets

        https://developer.android.google.cn/guide/topics/appwidgets/overview

        Jetpack Glance

        https://developer.android.google.cn/jetpack/androidx/releases/glance

        Jetpack Compose 運(yùn)行時(shí) (Runtime)

        https://developer.android.google.cn/jetpack/androidx/releases/compose-runtime

        歡迎您開(kāi)始嘗試并分享反饋意見(jiàn):

        https://issuetracker.google.com/issues/new?component=1097239&template=1611667

        Glance 提供了新式聲明性 Kotlin API,其類(lèi)似于您在 Jetpack Compose 中使用的 API,能夠幫助您用更少的代碼構(gòu)建更美觀的自適應(yīng) App Widgets。

        https://developer.android.google.cn/jetpack/compose

      谷歌發(fā)布 Jetpack Glance Alpha 版,構(gòu)建安卓 12 小組件更輕松

      △ Glance “Hello World” Widgets 示例

        class GreetingsWidget(private val name: String): GlanceAppWidget() {

        @Composable

        override fun Content() {

        Text(text = “Hello $name”)

        }

        }

        class GreetingsWidgetReceiver : GlanceAppWidgetReceiver() {

        override val glanceAppWidget = GreetingsWidget(“Glance”)

        }

        工作原理

        Glance 提供了可組合項(xiàng)的基礎(chǔ)組件集,助您打造 “一目了然” 的體驗(yàn)?,F(xiàn)在,我們將提供更多的 App Widgets。Glance 利用 Jetpack Compose 運(yùn)行時(shí) (Runtime),可以將可組合項(xiàng)轉(zhuǎn)化為實(shí)際的 RemoteViews,并在 App Widgets 中顯示。

      谷歌發(fā)布 Jetpack Glance Alpha 版,構(gòu)建安卓 12 小組件更輕松

      △ Glance 結(jié)構(gòu)示意圖

        可組合項(xiàng)

        https://developer.android.google.cn/reference/kotlin/androidx/compose/runtime/Composable

        RemoteViews

        https://developer.android.google.cn/reference/android/widget/RemoteViews

        這意味著 Glance 需要啟用 Compose,且依賴(lài)于運(yùn)行時(shí) (Runtime)、圖形 (Graphics) 和單元界面 Compose 層,但它與其他現(xiàn)有的 Jetpack Compose 界面元素之間不具備直接互操作性。但是,您可以分享應(yīng)用中的狀態(tài)或任何其他邏輯,以此來(lái)打造一目了然的界面。

        啟用 Compose

        https://developer.android.google.cn/jetpack/compose/interop/adding#anchor

        Compose 層

        https://developer.android.google.cn/jetpack/compose/layering

        Alpha 版介紹

        此初始版本引入了主要的 API,不僅能夠?qū)崿F(xiàn)與現(xiàn)有 RemoteViews 之間的互操作性,還能幫助您構(gòu)建 App Widgets。

        以下是該開(kāi)發(fā)庫(kù)提供的內(nèi)容概覽:

        通過(guò) GlanceAppWidget 和 GlanceAppWidgetReceiver 聲明您的 App Widgets。

        GlanceAppWidget

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/GlanceAppWidget

        GlanceAppWidgetReceiver

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/GlanceAppWidgetReceiver

        利用 Glance 可組合項(xiàng)的初始集組合您的界面: Box、Row、Column、Text、Button、LazyColumn、Image、Spacer。

        Box、Row、Column、Spacer

        https://developer.android.google.cn/reference/kotlin/androidx/glance/layout/package-summary#top-level-functions

        Text

        https://developer.android.google.cn/reference/kotlin/androidx/glance/text/package-summary#text

        Button

        https://developer.android.google.cn/reference/kotlin/androidx/glance/package-summary#button

        LazyColumn

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/lazy/package-summary#lazycolumn

        Image

        https://developer.android.google.cn/reference/kotlin/androidx/glance/package-summary#image

        利用 GlanceModifier 方法將修飾符應(yīng)用于可組合項(xiàng):

        https://developer.android.google.cn/reference/kotlin/androidx/glance/GlanceModifier.html

        利用預(yù)定義的 Action 處理用戶交互:

        https://developer.android.google.cn/reference/kotlin/androidx/glance/action/package-summary

        actionStartActivity

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/action/package-summary#actionstartactivity

        actionRunCallback

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/action/package-summary#actionruncallback

        actionStartService

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/action/package-summary#actionstartservice

        actionStartBroadcastReceiver

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/action/package-summary#actionstartbroadcastreceiver

        通過(guò) ActionParameters 為 Action 提供參數(shù):

        https://developer.android.google.cn/reference/kotlin/androidx/glance/action/ActionParameters

        通過(guò)定義 SizeMode.Single、SizeMode.Exact 或 SizeMode.Responsive 來(lái)處理不同的 Widgets 布局。

        SizeMode.Single

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/SizeMode.Single

        SizeMode.Exact

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/SizeMode.Exact

        SizeMode.Responsive

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/SizeMode.Responsive

        不同的 Widgets 布局

        https://developer.android.google.cn/guide/topics/appwidgets/layouts

        提供 GlanceStateDefinition,以保留 GlanceAppWidget 狀態(tài)。

        GlanceStateDefinition

        https://developer.android.google.cn/reference/kotlin/androidx/glance/state/GlanceStateDefinition.html

        GlanceAppWidget

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/state/package-summary

        提供本地組合,例如 LocalContext、LocalState、LocalGlanceId、LocalSize:

        https://developer.android.google.cn/reference/kotlin/androidx/glance/package-summary#top-level-properties

        通過(guò) AndroidRemoteViews 可組合項(xiàng)實(shí)現(xiàn)與您現(xiàn)有 RemoteViews 之間的互操作。

        AndroidRemoteViews

        https://developer.android.google.cn/reference/kotlin/androidx/glance/appwidget/package-summary#androidremoteviews

        RemoteViews

        https://developer.android.google.cn/reference/android/widget/RemoteViews.html

        我們還將推出更多功能,例如默認(rèn)主題,更完善的 Android Studio 支持等等。敬請(qǐng)期待新版本:

        https://developer.android.google.cn/jetpack/androidx/releases/glance

        注意: 雖然 SDK 的最低版本是 21,但 Alpha 版目前支持兼容的最低版本為 SDK v23。

        △ 在 Android 12 中構(gòu)建新式 Android App Widgets

        Glance 使用入門(mén)

        您可以在 GitHub 上查看示例,以便快速入門(mén)。也可以在最新的穩(wěn)定版 Android Studio 中使用 Glance,但首先需要按照 Jetpack Compose 文檔中的步驟進(jìn)行設(shè)置,因?yàn)?Glance 依賴(lài)于 Compose 運(yùn)行時(shí) (Runtime)。

        示例

        https://github.com/android/user-interface-samples/tree/glance/AppWidget/glance-widget

        穩(wěn)定版 Android Studio

        https://developer.android.google.cn/studio

        Jetpack Compose 文檔

        https://developer.android.google.cn/jetpack/compose/interop/adding#setup

        此外,您還可以查看 AndroidX 代碼庫(kù)中的進(jìn)階示例:

        https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/

        編寫(xiě)您自己的插件,您可以擴(kuò)展 Android Gradle Plugin 并根據(jù)您的項(xiàng)目需求自定義您的構(gòu)建!

      谷歌發(fā)布 Jetpack Glance Alpha 版,構(gòu)建安卓 12 小組件更輕松

      △ ResponsiveAppWidget.kt 演示

        ResponsiveAppWidget.kt

        https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ResponsiveAppWidget.kt

      特別提醒:本網(wǎng)信息來(lái)自于互聯(lián)網(wǎng),目的在于傳遞更多信息,并不代表本網(wǎng)贊同其觀點(diǎn)。其原創(chuàng)性以及文中陳述文字和內(nèi)容未經(jīng)本站證實(shí),對(duì)本文以及其中全部或者部分內(nèi)容、文字的真實(shí)性、完整性、及時(shí)性本站不作任何保證或承諾,并請(qǐng)自行核實(shí)相關(guān)內(nèi)容。本站不承擔(dān)此類(lèi)作品侵權(quán)行為的直接責(zé)任及連帶責(zé)任。如若本網(wǎng)有任何內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系我們,本站將會(huì)在24小時(shí)內(nèi)處理完畢。

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)