android-jetpack-compose

How does jetpack compose work under the hood

雨燕双飞 提交于 2020-02-25 04:13:33
问题 The new Jetpack compose component added to Arch component is like Flutter Ui making. How does it make the Ui though? Does it use a native code engine like Skia, or it still follows the ViewGroup way like before? 回答1: Compose creates one view currently named AndroidComposeView , which inherits ViewGroup, and it draws the widget tree on its canvas. It also processes motion/keyboard events for this view. There may be more helper views added to this view due to implementation details, but

What's the meaning of plus sign before a Kotlin method?

时间秒杀一切 提交于 2020-01-21 04:42:27
问题 I'm studiyng Kotlin and was watching the AndroidDevSummit, more specifically the presentation "Undestanding Compose" from Leland Richardson. While the presentation (at 28min26sec), he shown the following code: @Composable fun App(items: List<String>, query: String) { val results = +memo(items, query) { items.filter { it.matches(query) } } // ... } What does the "+" plus sign before the "memo" method? 回答1: + is kind of like an operator invoke for effects. The functions that return effects just

Can't find where the preview window is in Android Studio 4.0(Canary)

╄→尐↘猪︶ㄣ 提交于 2019-12-12 10:54:26
问题 I'm going through the tutorials about Jetpack which is ran in the Android Studio 4.0(Canary), please refer to the link post below. https://developer.android.com/jetpack/compose/tutorial Everything is ready except I can't find the preview window since I try to preview the "Composable" method. Can someone give me an exact hint that where the preview window is? 回答1: You have to build the project first (Build -> Make Project). I also had to restart Android Studio in order for previews to start