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
Google I/O '18 Extended In Daejeon Part1
Search
pluulove (노현석)
August 04, 2018
Programming
1.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Google I/O '18 Extended In Daejeon Part1
pluulove (노현석)
August 04, 2018
More Decks by pluulove (노현석)
See All by pluulove (노현석)
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
280
Google I/O Extended Incheon 2025 ~ What's new in Android development tools
pluu
1
590
N.E.X.T LEVEL
pluu
3
630
안드로이드 기술 이력서의 최소 조건
pluu
1
4.6k
I/O Extended Android in Korea 2024 ~ Whats new in Android development tools
pluu
0
800
Android Studio와 좀 더 친해지기
pluu
0
270
우리모두 삽질한다
pluu
0
1.5k
Re:Android Studio 설정 살펴보기 및 생산성 올리기
pluu
0
1.8k
What's new in Android development tools
pluu
1
980
Other Decks in Programming
See All in Programming
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
260
カツオ、ご期待ください
suneo3476
0
100
MCP Appsでつくるチャット駆動な地図アプリ
nakamori1024
0
100
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
240
手動確認はもう限界 〜XCUITestでCustom URL Schemeの遷移を起動種別ごとに自動テストする〜 / Testing Custom URL Schemes with XCUITest
otouto
0
350
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
2
300
iOSDC2026登壇資料.pdf
riofujimon
0
190
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5k
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
410
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
320
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
18
17k
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Site-Speed That Sticks
csswizardry
13
1.5k
GitHub's CSS Performance
jonrohan
1033
470k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Paper Plane (Part 1)
katiecoart
PRO
2
11k
Designing for Performance
lara
611
70k
Bash Introduction
62gerente
615
220k
Amusing Abliteration
ianozsvald
1
320
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
950
Visualization
eitanlees
153
17k
Transcript
ConstraintLayout Sunflower Back to the Future Pluu Android Developer /
Yanolja
Simple Complex LinearLayout RelativeLayout FrameLayout GridLayout TableLayout
Android Layouts Simple ۨইਓ ਵ۽ ҳࢿ ਵ۽ ੋ೧ ࢿמ ޙઁо
ߊࢤ Complex ۨইਓ ࢎਊ ߂ ਬо য۰ ࣻ ӝઓ ۨইਓ ಞӝ۽ח ࠗ
Preview in I/O '16 1.0 in 2017 1.1 in 2018
2.0-alpha1 in I/O '18 ConstraintLayout
ConstraintLayout ӝ, ߣٜ۽ ޘ ঋ ۄ࠳۞ܻ API Level 9
ഐജ (99.99%) Ө ҅க ҳઑܳ ਤ೧ ࢸ҅ػ ۨইਓ Android Studio ীࢲ স оמ
Why not RelativeLayout? ConstraintLayout ؊ ъ۱ ؊ ݆ അ,
ۄ࠳۞ܻ ഋక۽ ઁҕ Android Studio UI بҳܳ ઁҕ
<RelativeLayout> <ImageView/> <ImageView/> <RelativeLayout> <TextView/> <LinearLayout> <TextView/> <RelativeLayout> <EditText/> </RelativeLayout>
</LinearLayout> <LinearLayout> <TextView/> <RelativeLayout> <EditText/> </RelativeLayout> </LinearLayout> <TextView/> </RelativeLayout> <LinearLayout> <Button/> <Button/> </LinearLayout> </RelativeLayout>
<android.suppo_.constraint.ConstraintLayout> <ImageView/> <ImageView/> <TextView/> <EditText/> <TextView/> <TextView/> <EditText/> <Bu`on/> <Bu`on/>
<TextView/> </android.suppo_.constraint.ConstraintLayout> ConstraintLayout
Feature
Connection
Button Right Left Bottom Top
Attributes Relative Positioning layout_constraintStart_toStartOf layout_constraintEnd_toEndOf layout_constraintTop_toTopOf layout_constraintBottom_toBottomOf layout_constraintBaseline_toBaselineOf layout_constraintStart_toEndOf layout_constraintEnd_toStartOf
layout_constraintTop_toBottomOf layout_constraintBottom_toTopOf
Center and Bias
Attributes Centering Positioning and Bias layout_constraintHorizontal_bias layout_constraintVertical_bias
Visibility
Visibility
Visibility (2)
Margins when Gone
android:layout_marginStart android:layout_marginEnd android:layout_marginLeft android:layout_marginTop android:layout_marginRight android:layout_marginBottom Attributes Margins layout_goneMarginStart layout_goneMarginEnd
layout_goneMarginLeft layout_goneMarginTop layout_goneMarginRight layout_goneMarginBottom Margins when Gone
<android.suppo_.constraint.ConstraintLayout> <Bu`on android:id="@+id/bu`on3" /> <TextView app:layout_constraintCircle="@id/bu`on3" app:layout_constraintCircleAngle="45" app:layout_constraintCircleRadius="140dp" /> <TextView
app:layout_constraintCircle="@id/bu`on3" app:layout_constraintCircleAngle="185" app:layout_constraintCircleRadius="80dp" /> </android.suppo_.constraint.ConstraintLayout> Circular positioning Added 1.1
Dimension A A A margin
Attributes Dimension layout_constrainedWidth="true|false" layout_constrainedHeight="true|false" layout_constraintWidth_min layout_constraintHeight_min layout_constraintWidth_max layout_constraintHeight_max Added 1.1
Attributes Percent Dimension layout_constraintWidth_default="spread|percent" layout_constraintHeight_default="spread|percent" wrap is Deprecated (WRAP_CONTENT and
layout_constrainedWidth=true) layout_constraintWidth_percent="0~1" layout_constraintHeight_percent="0~1"
<android.suppo_.constraint.ConstraintLayout> <ImageView android:layout_width="0dp" android:layout_height="0dp" android:background=“@color/colorAccent" app:layout_constraintDimensionRatio="3:2" /> </android.suppo_.constraint.ConstraintLayout> Ratio Dimension
Attributes Ratio Dimension layout_constraintDimensionRatio="width:height"
Chains
Chains HEAD
Spread Spread Inside Weighted Spread Packed A B C A
B C A B C A B C A B C Packed Chain with Bias Chain Style
Attributes Chains layout_constraintHorizontal_chainStyle ="spread|spread_inside|packed" layout_constraintVertical_chainStyle ="spread|spread_inside|packed" layout_constraintHorizontal_weight layout_constraintVertical_weight Weighted Chains
Helper Objects
Guidelines
Guideline Attributes android:orientation="vertical|horizontal" layout_constraintGuide_start="dimension" layout_constraintGuide_end="dimension" layout_constraintGuide_percent=“float"
Added 1.1 Barrier References multiple widgets as input, and creates
a virtual guideline based on the most extreme widget on the specified side
<android.suppo_.constraint.Barrier android:id="@+id/barrier" android:layout_width="wrap_content" android:layout_height="wrap_content" app:barrierDirection="end" app:constraint_referenced_ids="tv1,tv2" /> Barrier Added 1.1
Barrier Attributes barrierDirection="start|top|end|bottom" barrierAllowsGoneWidgets="true|false" constraint_referenced_ids="View IDs" Added 1.1
Added 1.1 Group
Group Attributes android:visibility="visible|invisible|gone" constraint_referenced_ids="View Ids" Added 1.1
Attribute Priority Group Visibility Ignore reference views visibility Added 1.1
Added 1.1 Placeholder A Placeholder provides a virtual object which
can position an existing object.
Placeholder Added 1.1 class MainActivity : Activity() { override fun
onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main_sta_) } fun select(v: View) { TransitionManager.beginDelayedTransition(root) placeholder.setContentId(v.id) } }
ConstraintSet
View ৬ যڌѱ Layout ೞחоܳ ܻ࠙ ConstraintLayout оח ઁডਸ ёച
ӝઓ ConstraintLayoutী ConstraintSetਸ ਊ оמ ࠂࣻ ConstraintSetਵ۽ ജ оמ Layoutਸ Үೞח Ѫ ইפ۽, Viewח Reload ೞ ঋ ConstraintSet
private val mConstraintSetNormal = ConstraintSet() private val mConstraintSetExpand by lazy(LazyThreadSafetyMode.NONE)
{ ConstraintSet().apply { load(this@MainActivity, R.layout.constraintset_expand) } } private var mShowExpandImage = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main_sta_) mConstraintSetNormal.clone(rootLayout) } fun toggleMode(v: View) { TransitionManager.beginDelayedTransition(rootLayout) mShowExpandImage = !mShowExpandImage applyConug()
super.onCreate(savedInstanceState) setContentView(R.layout.activity_main_sta_) mConstraintSetNormal.clone(rootLayout) } fun toggleMode(v: View) { TransitionManager.beginDelayedTransition(rootLayout) mShowExpandImage
= !mShowExpandImage applyConug() } private fun applyConug() { if (mShowExpandImage) { mConstraintSetExpand.applyTo(rootLayout) } else { mConstraintSetNormal.applyTo(rootLayout) } }
ConstraintSet (load or clone) TransitionManager.beginDelayedTransition (layout) ConstraintSet#applyTo(layout) Simple Flow
ConstraintSet Support ConstraintLayout and ConstraintSet support API 9 TransitionManager support
API 14
Trouble Shooting
Case 1 Title Sub Title View Required Title Sub Title
Required View ConstraintLayout ConstraintLayout
<android.suppo_.constraint.ConstraintLayout> <TextView android:id="@+id/lew" /> <TextView android:id="@+id/lew2" /> <View app:layout_constraintSta__toEndOf="@+id/barrier" />
<android.suppo_.constraint.Barrier android:id="@+id/barrier" app:barrierDirection="end" app:constraint_referenced_ids="lew,lew2" /> </android.suppo_.constraint.ConstraintLayout> Case 1
<android.suppo_.constraint.ConstraintLayout> <TextView android:id="@+id/lew" /> <TextView android:id="@+id/lew2" /> <View app:layout_constraintSta__toEndOf="@+id/barrier" />
<android.suppo_.constraint.Barrier android:id="@+id/barrier" app:barrierDirection="end" app:constraint_referenced_ids="lew,lew2" /> </android.suppo_.constraint.ConstraintLayout> Case 1
Case 2 Title Short Text ConstraintLayout Required Title Required Long
Text ConstraintLayout
Case 2 <android.suppo_.constraint.ConstraintLayout> <TextView android:id="@+id/lew" /> <TextView android:layout_width="wrap_content" app:layout_constrainedWidth="true" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1" app:layout_constraintSta__toEndOf="@id/lew" /> </android.suppo_.constraint.ConstraintLayout>
Case 2 <android.suppo_.constraint.ConstraintLayout> <TextView android:id="@+id/lew" /> <TextView android:layout_width="wrap_content" app:layout_constrainedWidth="true" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1" app:layout_constraintSta__toEndOf="@id/lew" /> </android.suppo_.constraint.ConstraintLayout>
Case 3 View View Required Button > View Required Button
> View ConstraintLayout ConstraintLayout
Case 3 <android.suppo_.constraint.ConstraintLayout> <TextView android:id="@+id/lew" android:layout_width="wrap_content" app:layout_constrainedWidth="true" app:layout_constraintEnd_toSta_Of="@id/barrier" app:layout_constraintSta__toSta_Of="parent" />
<ImageView android:id="@+id/lew2" android:layout_width="wrap_content" app:layout_constraintEnd_toSta_Of="@+id/right" app:layout_constraintHorizontal_bias="0" app:layout_constraintSta__toEndOf="@+id/lew" /> <Bu`on android:id="@+id/right" app:layout_constraintEnd_toEndOf="parent" /> <android.suppo_.constraint.Barrier android:id="@+id/barrier" app:barrierDirection="sta_" app:constraint_referenced_ids="lew2,right" /> </android.suppo_.constraint.ConstraintLayout>
Case 3 <android.suppo_.constraint.ConstraintLayout> <TextView android:id="@+id/lew" android:layout_width="wrap_content" app:layout_constrainedWidth="true" app:layout_constraintEnd_toSta_Of="@id/barrier" app:layout_constraintSta__toSta_Of="parent" />
<ImageView android:id="@+id/lew2" android:layout_width="wrap_content" app:layout_constraintEnd_toSta_Of="@+id/right" app:layout_constraintHorizontal_bias="0" app:layout_constraintSta__toEndOf="@+id/lew" /> <Bu`on android:id="@+id/right" app:layout_constraintEnd_toEndOf="parent" /> <android.suppo_.constraint.Barrier android:id="@+id/barrier" app:barrierDirection="sta_" app:constraint_referenced_ids="lew2,right" /> </android.suppo_.constraint.ConstraintLayout>
ConstraintLayout 2.0
MotionLayout A subclass of ConstraintLayout
MotionLayout <View>
MotionLayout <View>
MotionLayout <View> MotionScene <ConstraintSet> <ConstraintSet>
MotionLayout <View> MotionScene <ConstraintSet> <ConstraintSet> CustomAttribute CustomAttribute
MotionLayout <View> MotionScene <ConstraintSet> <ConstraintSet> CustomAttribute CustomAttribute <OnTouch>
MotionLayout <View> MotionScene <ConstraintSet> <ConstraintSet> CustomAttribute CustomAttribute <OnTouch> <Helper>
MotionLayout <View> MotionScene <ConstraintSet> <ConstraintSet> CustomAttribute CustomAttribute <OnTouch> <Helper>
begin end Keyframe
Keyframe begin end
MotionLayout <View> MotionScene <ConstraintSet> <ConstraintSet> CustomAttribute CustomAttribute <OnTouch> <KeyFrameSet> KeyAttribute
KeyPosition <Helper>
ConstraintLayout Easily create User Interface Flexible layout Flat hierarchies UI
Builder Back compatible starting from API 9 (99.99% of devices) Support library : ~160Kb
Pluu Help
[email protected]
Thank you! @pluulove / Yanolja