Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Grid表示のレイアウトで Flow layoutsを使う
Search
cffYoHa
January 29, 2025
Technology
420
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Grid表示のレイアウトで Flow layoutsを使う
Mobile勉強会 ウォンテッドリー × チームラボ × Sansan #18 〜新技術の導入〜
cffYoHa
January 29, 2025
More Decks by cffYoHa
See All by cffYoHa
土掘るHaptics
cffyoha
0
160
Other Decks in Technology
See All in Technology
継続的なAIコスト最適化
bgpat
1
290
FOSS4Gを活用した自治体業務DXの試み
470715
0
150
不可逆な意思決定を避けながら10億超の顧客データを AI Ready にするデータ基盤設計
baseballyama
1
310
WasmをRustにする
sansantech
PRO
0
200
生成AIで高い生産性を求められて、 悩み、乗り越えた話
mot_techtalk
2
170
初対面のメンバーがチームを組み、Claude Codeでゼロからサービスをリリース
mkdev10
1
120
味覇で作るパスタが美味い - 20261001_yabaubuki.dev
livesense
PRO
0
130
Deep Data Security 機能解説
oracle4engineer
PRO
2
800
Snapshot Testing in Practice: Predictable and Reliable SwiftUI Views
fespinoza
0
210
go-sqletch
moznion
0
140
事業活動を AI Ready にする攻めと守りのデータエンジニアリング / data-engineering-for-ai-ready-business
pei0804
7
2.7k
メルペイ 会計システム概要と歴史
mewuto
1
210
Featured
See All Featured
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
450
The SEO Collaboration Effect
kristinabergwall1
1
590
Technical Leadership for Architectural Decision Making
baasie
3
600
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
Side Projects
sachag
456
43k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
320
WENDY [Excerpt]
tessaabrams
14
40k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
620
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
360
Producing Creativity
orderedlist
PRO
348
41k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Transcript
Grid表⽰のレイアウトで Flow layoutsを使う Mobile勉強会 ウォンテッドリー × チームラボ × Sansan #18
〜新技術の導⼊〜 @cffYoHa
⾃⼰紹介 • @cffYoHa(ようは) • Fenrir Inc. ◦ Android エンジニア •
DroidKaigi Staff
実現したいレイアウト • スタンプラリー台紙のようなレイアウト
実現したいレイアウト • スタンプラリー台紙のようなレイアウト ◦ 左から右下に向かって敷き詰める
実現したいレイアウト • スタンプラリー台紙のようなレイアウト ◦ 左から右下に向かって敷き詰める ◦ 各アイテムの台紙部分の形は固定
実現したいレイアウト • スタンプラリー台紙のようなレイアウト ◦ 左から右下に向かって敷き詰める ◦ 各アイテムの台紙部分の形は固定 ◦ スクロール可能な画⾯のUI要素として追加
なぜ話すのか • 格⼦のレイアウトはLazy gridsが最適だと決めつけていた • Grid表⽰の定番の選択肢であるLazy gridsではうまくいかなかった
LazyVerticalGridで実装してみる
LazyVerticalGridで実装してみる 右端に余分なスペースが残ってしまう
そもそも • 親要素のLazyColumnとネストが発⽣しているから • ビルドせずにUIを作り続けたせいで気づくのに遅れた。。。
Flow layoutsを使う • 特徴 ◦ コンテナのスペースが不⾜すると アイテムが次の⾏に流れ込む ◦ チップやフィルタリング UIに最適
◦ 100個未満の少量のアイテムに最適 • 注意点 ◦ 現時点ではExperimental https://developer.android.com/develop/ui/compose/layouts/flow
FlowRowで実装
FlowRowで実装
FlowRowで実装 🥳
Flow layoutsを使う • 特徴 ◦ コンテナのスペースが不⾜すると アイテムが次の⾏に流れ込む ◦ チップやフィルタリング UIに最適
◦ 100個未満の少量のアイテムに最適 • 注意点 ◦ 現時点ではExperimental https://developer.android.com/develop/ui/compose/layouts/flow
Flow layoutsを使う • 特徴 ◦ コンテナのスペースが不⾜すると アイテムが次の⾏に流れ込む ◦ チップやフィルタリング UIに最適
◦ 100個未満の少量のアイテムに最適 • 注意点 ◦ 現時点ではExperimental https://developer.android.com/develop/ui/compose/layouts/flow
振り返る • FlowRowおよびFlowColumnは、100個未満の少量のアイテムに最適 FlowRow and FlowColumn is perfect for a
small number of items, less than 100 items. https://developer.android.com/jetpack/androidx/releases/compose-foundation
振り返る • FlowRowおよびFlowColumnは、100個未満の少量のアイテムに最適 FlowRow and FlowColumn is perfect for a
small number of items, less than 100 items. https://developer.android.com/jetpack/androidx/releases/compose-foundation 🤔 アイテム数が 多いとき‧‧
遅延読み込みに対応した flow itemsを使う • ContextualFlowRow /Column ◦ androidx.compose.foundation:foundation-*:1.7.0 以上が必要
引数を観察してみる • maxLines ◦ 表⽰⾏数を制限 • overflow ◦ itemがoverflow時に表⽰する内容を指定 ▪
Clip : デフォルト値 maxLinesを超えたものは⾮表⽰ ▪ Visible : maxLinesを超えていてもすべて表⽰ ▪ ExpandIndicator : 追加でアイテムを読み込むインジケーターやボタンを表⽰ ▪ ExpandOrCollapseIndicator : ExpandIndicator に「折りたたむ」オプションが追加
使おうとしたところ‧‧‧ https://android-review.googlesource.com/c/platform/frameworks/support/+/3409998
遅延読み込みに対応した flow itemsを使う • ContextualFlowRow /Column ◦ androidx.compose.foundation:foundation-*:1.7.0 以上が必要
内容の抜粋 • ContextualFlowRow/Column ◦ 1.7で導⼊したがまだ安定化しておらず、実装が望ましくないため、Deprecated • FlowRow/Column ◦ 1.7でoverflow を引数に含むExperimentalなFlowRow/Columnを導⼊したがこれを
Deprecatedとする ◦ 引数にoverflow を含まないFlowRow/Columnを今後は利⽤可能 ▪ overflowはデフォルト値のClipが適⽤される
引数にoverflow を含まないFlowRow https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/FlowLayout.kt
内容の抜粋 • ContextualFlowRow/Column ◦ 1.7で導⼊したがまだ安定化しておらず、実装が望ましくないため、Deprecated • FlowRow/Column ◦ 1.7でoverflow を引数に含むExperimentalなFlowRow/Columnを導⼊したがこれを
Deprecatedとする ◦ 引数にoverflow を含まないFlowRow/Columnを今後は利⽤可能 ▪ overflowはデフォルト値のClipが適⽤される • 今後 ◦ ContextualFlowRow/Columnの多くのユースケースはFlowRow/Columnで実現可能 ◦ 完全に代替可能でもないため、それらのケースを別の⽅法で解決することも模索中
まとめ • 親ViewがScrollableなレイアウトにおいて、Grid表⽰を実装する際は Flow layoutsを試してみると良さそう • ContextualFlowRow/Columnの多くのユースケースは FlowRow/Columnで実現可能なため、FlowRow/Columnを利⽤しよう • 遅延読み込みを実装したい場合は今後に期待
参考 • https://developer.android.com/develop/ui/compose/lists • https://developer.android.com/develop/ui/compose/layouts/flow • https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary.html • https://android-review.googlesource.com/c/platform/frameworks/support/+/3409998 •
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/foundation/found ation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/FlowLayout.kt