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
複雑なレイアウト組む時あるあるは コンポーネント化で解決しよう
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
ぎーにょ
March 19, 2019
Technology
1.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
複雑なレイアウト組む時あるあるは コンポーネント化で解決しよう
ぎーにょ
March 19, 2019
More Decks by ぎーにょ
See All by ぎーにょ
AndroidにおけるNotificationのおさらい & Android16の新API Progress-centric Notifications
ginyolith
0
290
Google IO 2022 Jetpack Composeのパフォーマンス 社内LT会資料
ginyolith
0
1.4k
各OS1人ずつ開発の辛みあるあるは アーキテクチャで解決出来そう
ginyolith
2
450
クリぼっちでも出来る issue駆動開発
ginyolith
0
610
Other Decks in Technology
See All in Technology
1つのリクエストを追って理解する - llm-dのP/D分離
akhino
1
160
会社説明資料
persolserverworks
0
9.8k
夫婦で子育てするための育児標準化
codmoninc
PRO
0
460
WasmをRustにする
sansantech
PRO
0
280
Tofu-Controller lightning talk @ Containerday 2026
gionn
0
120
フィンテック養成勉強会#68
finengine
0
150
Local CI × GitHub Actions
gogutan
3
230
脆弱性診断って、何をしているの? 〜弱点を見つけて、会社の改善につなげるまで〜
keeg
0
930
Running Kotlin + Quarkus with Lambda
nealle
1
4k
AI導入は済んだ。次は統制を作り替える番だ_AI×開発組織 Summit 2026
techtekt
PRO
0
360
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
160
JAWS-UGグッズ職人仕事の流儀
kentapapa
0
120
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Statistics for Hackers
jakevdp
799
230k
It's Worth the Effort
3n
188
29k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
Build your cross-platform service in a week with App Engine
jlugia
234
19k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
Chasing Engaging Ingredients in Design
codingconduct
0
360
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
エンジニアに許された特別な時間の終わり
watany
109
250k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Transcript
ෳࡶͳϨΠΞτΉ࣌͋Δ͋Δ ίϯϙʔωϯτԽͰղܾ͠Α͏ ͋Δ͋ΔLTʙεϚϗΞϓϦ։ൃΤϯδχΞʙ VOL.3 2019/03/19 @GINYOLITH_TECH
ςΩετ SELF INTRODUCTION data class Ginyolith( val realName : String
= “Fumiya Akagi", val nickName : String = "ぎーにょ", var belongingTo : String = "株式会社アイリッジ", var position : String = "Androidアプリ開発", val loves : List<String> = mutableListOf( "写真", "アカペラ(音楽)", "インドカレー", "仮面ライダー"), val twitterId : String = "@ginyolith_tech" ) : Human()
AGENDA ࠓ͓͢Δࣄ ▸ ෳࡶͳϨΠΞτΛΉ࣌͋Δ͋Δ ▸ Style/CustomView/include/Fragment ͷಛੑ ▸ Style/CustomView/include/Fragment ͷ͍͚
▸ ݱࡏͷ՝
ARUARU ෳࡶͳϨΠΞτΛΉ࣌͋Δ͋Δ ▸ ωετ͗ͯ͢͠ҙຯෆ໌ʹͳΔlayout.xml ▸ େྔͷViewΛίϯτϩʔϧ͢ΔɺActivity/Fragment/ViewModel ▸ widthheightɺbackgroundͷઃఆʹσδϟϰΛײ͡Δࣄ͕ଟൃ ▸ Α͘Θ͔Μͳ͍͚Ͳdatabinding͕ಈ͔ͳ͍ʢٽʣ
HOW TO COMMONIZE VIEWS VIEWͷڞ௨Խͷํ๏ FRAGMENT INCLUDE STYLE CUSTOM VIEW
ACTIVITY DIMEN.XML
HOW TO COMMONIZE VIEWS ࠓ͓͢Δࣄ FRAGMENT INCLUDE STYLE CUSTOM VIEW
ͦΕͧΕԿ͕ग़དྷΔͷʁ Ͳ͏͍͚Δͷʁ
HOW TO COMMONIZE VIEWS STYLE ▸ ʮView Οϯυͷ֎؍ॻࣜΛࢦఆ͢ΔϓϩύςΟͷू߹ʯ by Google
Developers ▸ ThemeʹԠͯ͡ಈతʹ৭Λఆٛ͢Δ͜ͱՄೳ ▸ ϩδοΫঢ়ଶΛ࣋ͭ͜ͱෆՄೳɻ͋͘·ͰݟͨͷΈ੍ޚ
HOW TO COMMONIZE VIEWS - STYLE - View Οϯυͷ֎؍ॻࣜΛࢦఆ͢ΔϓϩύςΟͷू߹ <View
android:layout_height=“match_parent" android:layout_width="1dp" android:layout_marginBottom=“10dp" android:layout_marginTop=“10dp” android:background=“@color/borderGray”/> <View style="@styleAppTheme.Border.Gray"/>
HOW TO COMMONIZE VIEWS - STYLE - View Οϯυͷ֎؍ॻࣜΛࢦఆ͢ΔϓϩύςΟͷू߹ <View
android:layout_height=“match_parent" android:layout_width="1dp" android:layout_marginBottom=“10dp" android:layout_marginTop=“10dp” android:background=“@color/borderGray”/> <View style="@style/ AppTheme.Border.Gray"/> <style name="AppTheme.Border"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">1dp</item> <item name="android:layout_marginBottom">10dp</item> <item name="android:layout_marginTop">10dp</item> </style> <style name="AppTheme.Border.Gray" parent="AppTheme.Border"> <item name="android:background">@color/borderGray</item> </style>
HOW TO COMMONIZE VIEWS INCLUDE ▸ layout.xmlͰ࡞ͨ͠ϨΠΞτΛ͍·Θ͢ ▸ ϩδοΫΛแ͠ͳ͍ ▸
ϩδοΫͱϨΠΞτΛͯ͠ɺϩδοΫ͚ͩڞ༗Խ͕Մೳ ▸ ϩδοΫͰContextΛऔಘ͢Δͷ͕͍͠
HOW TO COMMONIZE VIEWS - INCLUDE - ϩδοΫΛแ͠ͳ͍ class UserViewModel()
{ val searchTerm :String fun search() { repository .search(searchTerm) } } <?xml version="1.0" encoding="utf-8"?> <layout> <data> <variable name="viewModel" type=“hoge.UserViewModel”/> </data> <android.support.constraint.ConstraintLayout> <Button android:onClick="@{() -> viewModel.search()}"/> </android.support.constraint.ConstraintLayout> </layout> component_user_search.xml <include layout=“@layout/component_user_search” app:viewModel="@{userViewModel}"/> ϩδοΫͱঢ়ଶΛ ࣋ͭΠϯελϯεΛೖՄ ೳ
<?xml version="1.0" encoding="utf-8"?> <layout> <data> <variable name="viewModel" type=“hoge.UserViewModel”/> </data> <android.support.constraint.ConstraintLayout>
<Button android:onClick="@{() -> viewModel.search()}"/> </android.support.constraint.ConstraintLayout> </layout> HOW TO COMMONIZE VIEWS - INCLUDE - ϩδοΫͱϨΠΞτΛͯ͠ɺϩδοΫ͚ͩڞ༗Խ͕Մೳ component_user_search.xml <?xml version="1.0" encoding="utf-8"?> <layout> <data> <variable name="viewModel" type=“hoge.UserViewModel”/> </data> <android.support.constraint.ConstraintLayout> <TextView android:onClick="@{() -> viewModel.search()}"/> </android.support.constraint.ConstraintLayout> </layout> component_user_search_text.xml ΄΅ߏಉ͕ͩ͡ɺඍົʹݟ ͕ͨҟͳΔ ΄΅ߏಉ͕ͩ͡ɺ ඍົʹݟ͕ͨҟͳΔ
HOW TO COMMONIZE VIEWS - INCLUDE - ϩδοΫͱϨΠΞτΛͯ͠ɺϩδοΫ͚ͩڞ༗Խ͕Մೳ component_user_search.xml <include
layout="@layout/hoge" app:viewModel="@{userViewModel}"/> <include layout=“@layout/fuga" app:viewModel="@{userViewModel}"/> ΄΅ߏಉ͕ͩ͡ɺඍົʹݟ ͕ͨҟͳΔ ϩδοΫͷڞ௨ԽΛɺ ಛघͳॲཧΛॻ͔ͣʹߦ͏͜ͱ͕Մೳ component_user_search_text.xml
HOW TO COMMONIZE VIEWS CUSTOM VIEW ▸ ঢ়ଶͱϩδοΫΛแ ▸ contextΛ༻͍ͨϩδοΫΛ࣮ՄೳʢIntentͷൃߦͳͲʣ
▸ ಠࣗͷattributeΛఆٛग़དྷΔ ▸ طଘͷViewΛ֦ுͯ͠͏͜ͱՄೳ ▸ ViewGroupΛࣗ࡞͢ΔࣄՄೳ ੍͕গͳ͘ɺ෯͍ػೳͱҙຯΛͨͤΒΕΔ
HOW TO COMMONIZE VIEWS - CUSTOM VIEW - ঢ়ଶͱϩδοΫΛแ STYLE
VIEW INCLUDE VIEW VIEW VIEW LOGIC(INJECTED) CUSTOM VIEW VIEW VIEW VIEW LOGIC ATTRIBUTE LOGIC(INJECTED) UI
HOW TO COMMONIZE VIEWS - CUSTOM VIEW - ঢ়ଶͱϩδοΫΛแ CUSTOM
VIEW VIEW VIEW VIEW LOGIC ATTRIBUTE LOGIC(INJECTED) UI ViewͷΈ߹Θͤʢ୯ମViewՄʣ ViewͷݟͨɺଐੑɺStyle Viewݻ༗ͷଐੑΛఆٛՄೳ Viewʹݻ༗ϩδοΫΛΧϓηϧԽ OnClickListenerɺϩδοΫΛೖ
HOW TO COMMONIZE VIEWS FRAGMENT ▸ ಠࣗʹϥΠϑαΠΫϧΛ࣋ͭɻʢ།ҰϥΠϑαΠΫϧपΓͷॲཧΛΧϓηϧԽՄೳʣ ▸ Viewͱͷίϛϡχέʔγϣϯ͍͠ɻ ▸
ಛఆͷActivity/Fragement͔ΒͷΈݺͼग़ͤΔΑ͏ʹ͢Δରࡦ͕ඞཁ ▸ ϩδοΫΛೖग़དྷͳ͍ ▸ CustomViewStyleͱൺɺݟͨΛ͔Β੍ޚ͠ਏ͍ ಠཱੑ͕ߴ͍CUSTOMVIEW
Ͳ͏͍͚Ε͍͍ʁ ಛੑཧղͨ͠
COMPARISON OF COMMONIZING WAYS ൺֱ / Style include CustomView Fragment
LifecycleΛݕ × × ˚ ◦ View͔Βঢ়ଶΛ੍ޚ × ˚ ◦ × layout.xmlͰݟͨΛ੍ޚ ◦ × ◦ × ϩδοΫΛแ × × ◦ ◦ ϩδοΫΛೖ × ◦ ◦ × attr.xmlʹΑΔΧελϜཁૉ × × ◦ ×
COMPARISON OF COMMONIZING WAYS ൺֱ / Style include CustomView Fragment
LifecycleΛݕ × × ˚ ◦ View͔Βঢ়ଶΛ੍ޚ × ˚ ◦ × layout.xmlͰݟͨΛ੍ޚ ◦ × ◦ × ϩδοΫΛแ × × ◦ ◦ ϩδοΫΛೖ × ◦ ◦ × attr.xmlʹΑΔΧελϜཁૉ × × ◦ × ݟͨͷڞ௨ԽʹಛԽ
COMPARISON OF COMMONIZING WAYS ൺֱ / Style include CustomView Fragment
LifecycleΛݕ × × ˚ ◦ View͔Βঢ়ଶΛ੍ޚ × ˚ ◦ × layout.xmlͰݟͨΛ੍ޚ ◦ × ◦ × ϩδοΫΛแ × × ◦ ◦ ϩδοΫΛೖ × ◦ ◦ × attr.xmlʹΑΔΧελϜཁૉ × × ◦ × ϩδοΫΛೖՄೳ
COMPARISON OF COMMONIZING WAYS ൺֱ / Style include CustomView Fragment
LifecycleΛݕ × × ˚ ◦ View͔Βঢ়ଶΛ੍ޚ × ˚ ◦ × layout.xmlͰݟͨΛ੍ޚ ◦ × ◦ × ϩδοΫΛแ × × ◦ ◦ ϩδοΫΛೖ × ◦ ◦ × attr.xmlʹΑΔΧελϜཁૉ × × ◦ × Ұ௨Γग़དྷΔ
COMPARISON OF COMMONIZING WAYS ൺֱ / Style include CustomView Fragment
LifecycleΛݕ × × ˚ ◦ View͔Βঢ়ଶΛ੍ޚ × ˚ ◦ × layout.xmlͰݟͨΛ੍ޚ ◦ × ◦ × ϩδοΫΛแ × × ◦ ◦ ϩδοΫΛೖ × ◦ ◦ × attr.xmlʹΑΔΧελϜཁૉ × × ◦ × VIEW͔Βͷ੍ޚ ʹ੍͓͍ͯ
·ͱΊ
SUMMURY ڞ௨Խର͕ɾɾɾ ෳͷVIEWͷ Έ߹Θͤ STYLE NO Yes ϩδοΫΛ แ Yes
VIEW͔Βݟ ͨΛ੍ޚ INCLUDE NO NO FRAGMENT CUSTOM VIEW Yes
SUMMARY ·ͱΊ ▸ AndroidͷViewͷڞ௨Խʹ৭ʑͳํ๏͕͋Δ ▸ ੍ҙຯ͚ʹԠ͍͚ͯ͡Δͱ… ▸ Ϧʔμϒϧͳίϯϙʔωϯτʹ ▸ ༨ͳ࣮ΛͤͣΑΓޮతʹViewΛ࡞Մೳ
PROBLEMS ՝ ▸ component_ͩͬͨΓview_ͩͬͨΓɺ໋໊نଇ ͕όϥόϥ ▸ atomic designͷߟ͑ํΛద༻ͯ͠componentͷ ཻΛཧग़དྷͳ͍͔ߟ͍͑ͯΔ
THANK YOU FOR LISTENING!!