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
410
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
150
Other Decks in Technology
See All in Technology
DEFCON_CHV_CTF_Write-up.pdf
bata_24
0
150
SREは、MCPとAutopilotをこう使え!
kazumax55
1
450
越境するなら専門用語を使うな高校校歌 / If you wanna cross border, you shouldn't use jargon
vtryo
0
130
絵ではじめるKubernetesセキュリティ
aoi1
3
340
20260912_スクフェス三河
kgnkhkr
0
340
消えない 動かない 効かない
yama3133
1
120
生成AIエージェントを用いた、 手動テスト手順書から自動テストへの 変換手法の検討
magicpod
0
110
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
4
550
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
690
2026-09-10 【Snowflake World Tour Tokyo 2026】dbt Core と Snowflake で実現する多層的なデータガバナンス / Multi-Layered Data Governance Powered by dbt Core and Snowflake
civitaspo
0
370
俺の仕事は AIに奪われないし、たぶんその BIも要らない
hikaruri
0
380
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
180
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Why Our Code Smells
bkeepers
PRO
340
58k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Unsuck your backbone
ammeep
672
58k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
930
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
380
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
790
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
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