Over the course of the last few years Android development has gonethrough significant changes in how we structure our apps, the languagewe use for development, the tooling & libraries that help us speed upour development and the improvements in testing our apps. What had notchanged in all these years is the Android UI toolkit. This changes withJetpack Compose that aims to re-imagine what Android UI developmentwould look like using declarative programming principles. It is heavilyinfluenced by existing web and mobile frameworks such as React, Litho,Vue & Flutter and would be a paradigm shift in Android UI development aswe know it.
This repository aims to show the Jetpack Compose way of building commonAndroid UI that we are accustomed to building.
I've also used the examples listed in this repo and given talks at conferences. If video is your preferred medium of learning, you can head to the links below
360|AnDev 2020: Learning Jetpack Compose By ExampleVideo| Slides
Android Summit 2020: Learn Jetpack Compose By Example v2Slides
To try out this sample app, you need to at least use the latest versionof Android Studio. This project has been tested against Android Studio Artic Fox.You can download it here.In general, Jetpack Compose requires you to use the Canary version ofAndroid Studio.
Each example is meant to be self contained and tries to explain all theconcepts that its using with comments. Compose also comes with thisnifty feature that lets you preview each component in the IntelliJ IDEitself. To do so, go to any of the examples and then click onthe preview button in the top right corner. This is possible if your@Composable
component has a corresponding @Preview
method associatedwith it. Look at the examples below for all this to make a bit moresense.
Example | Preview |
---|---|
How do I display text on the screen using Jetpack Compose? | |
How do I make a view clickable and do actions when clicked? | |
How do I add padding around a view? How do I add an offset to a layout? How do I enforce a layout to have a fixed aspect ratio? |
|
How do I add a background color to any section of the screen? Example 1 Example 2 |
|
How do I get FrameLayout like functionality to stack views on top of one another? | |
How do I do animation in Jetpack Compose? Example: Rotation Animation Example: Color Change Animation |
|
How do styles & themes work in Jetpack Compose? How do I add dark mode capability to my app? |
Example | Preview |
---|---|
How do I align the baseline of two views? What's the layout weight equivalent in Jetpack Compose? Example with equal weights Example with unequal weights How do I auto arrange my views similar to FlexBox? Add space between views Evenly distribute space Add space around the views Tightly packed centering of views |
|
How do I use constraint layouts? How do I use guidelines with constraint layouts? How do I add barriers when using constraint layouts? How do I add bias when using constraint layouts? |
Example | Preview |
---|---|
How do I draw using a canvas? | |
Example of a measuring scale component | |
How do I make a view zoomable? | |
How do I detect touch events in a custom view? |
Example | Preview |
---|---|
How can I use Jetpack Compose components inside existing screens? |
Example | Preview |
---|---|
How do I write a simple UI Test in Jetpack Compose? How do I test "Composables"? |
Author: Vinay Gaba (vinaygaba@gmail.com)
Copyright 2020 Vinay Gaba
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
关于 Jetpack Compose 的学习本想只是简单的快速学习一下,结果万万没想到,竟然一下子折腾了好几个月。。。 下面将之前记录的 Jetpack Compose 相关的学习博文进行一个汇总链接整理,方便我以后自己查阅,也希望能帮到一些有正在学习 Compose 的道友。 Jetpack Compose 中的 state 核心思想 Jetpack Compose 中的 Modifier Je
JetBrains 发布的 Jetpack Compose for Desktop 是基于 Google 用于 Android UI 开发的 Jetpack Compose 工具包,Jetpack Compose for Desktop 框架提供了一种声明式和反应性的方法来使用 Kotlin 构建 UI 。 仓库结构 artwork -设计工件 benchmarks -收集基准 ci -持续集成助
Jetpack/JetBrains Compose Playground Introduction ��♂️ This is an Jetpack Compose example project. I'm collecting a bunch of sample codes for Jetpack Compose. I also collect informations/tutorials on
C 是贝尔电话实验室的Dennis M. Ritchie于1972年开发的一种通用的,程序性的,命令式的计算机编程语言,用于开发UNIX操作系统。 C是使用最广泛的计算机语言。 它与Java编程语言一起在第一流程度上保持波动,这也是现代软件程序员中最受欢迎和最广泛使用的Java编程语言。
以下资源包含有关通过示例学习C的其他信息。 请使用它们来获得有关此主题的更多深入知识。 通过示例学习C的有用链接 编译和执行C Online - 高端服务器提供在线编译和执行C程序的机会。 关于K&R2的说明 - K&R2的一个很好的伴侣 C语言程序设计 - C程序设计语言的文学,历史和文化。 学习GNU调试器 - GDB - 调试C和C ++程序中的错误的调试工具。 Unix Makefile
C是贝尔电话实验室的Dennis M. Ritchie于1972年开发的一种通用的,程序性的,命令式的计算机编程语言,用于开发UNIX操作系统。 C是使用最广泛的计算机语言。 它与Java编程语言一起在第一流程度上保持波动,这也是现代软件程序员中最受欢迎和最广泛使用的Java编程语言。 听众 (Audience) 本教程是为需要从头开始理解C编程语言的软件程序员而设计的。 本教程将为您提供有关C编
我们有一个遗留应用程序,我们开始迁移到Jetpack Compose。该应用程序只有一个活动,使用带有导航XML图的导航组件在片段之间导航。 我们采取了这一做法: 每次迁移一个片段 为每个片段创建一个@Composable屏幕,该屏幕提供与片段相同的UI 从片段onCreateView()设置内容到新创建的屏幕 现在,假设我们有Fragment1包含一些操作来导航到Fragment2。在原始代码中