Android

Android Compose Advanced

Advanced Jetpack Compose: custom layouts, performance, animations, gestures, and testing

17 câu hỏi phỏng vấn·
Senior
1

How to create a Custom Layout in Compose?

Câu trả lời

Use the Layout { measurables, constraints -> } function. It allows measuring children with measurables.forEach { it.measure(constraints) }, then placing them with layout(width, height) { placeables.forEach { it.place(x, y) } }.

2

What is SubcomposeLayout?

Câu trả lời

SubcomposeLayout allows composing children dynamically based on constraints or measurements of other children. Useful for layouts where one element's size depends on another (e.g., measure header before composing body).

3

What are the 3 phases of the Compose lifecycle?

Câu trả lời

The 3 phases are: 1) Composition (UI tree creation, @Composable execution), 2) Layout (measurement and placement of elements), 3) Drawing (rendering to screen). Understanding these phases helps optimize performance.

4

What is derivedStateOf used for?

5

How to optimize recompositions in Compose?

+14 câu hỏi phỏng vấn

Nắm vững Android cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí