Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Google I/O '18 Extended In Daejeon Part1
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
240
Google I/O Extended Incheon 2025 ~ What's new in Android development tools
pluu
1
570
N.E.X.T LEVEL
pluu
3
630
안드로이드 기술 이력서의 최소 조건
pluu
1
4.4k
I/O Extended Android in Korea 2024 ~ Whats new in Android development tools
pluu
0
790
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
970
Other Decks in Programming
See All in Programming
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.1k
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
680
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
220
Press start. Python's next generation.
willingc
PRO
3
210
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
170
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
FastAPI の並行処理モデルを完全に理解する
hoto17296
8
3.1k
承認済みなのに差戻しできてしまうバグ、型で潰せます
shinchit
0
110
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
440
源内ハンズオン概要編
hideg
0
220
Hono + Inertia + React で LP を構築した話
oukayuka
2
170
バグを直したら useEffect が消えた
colorful12
3
710
Featured
See All Featured
Building AI with AI
inesmontani
PRO
1
1.2k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
First, design no harm
axbom
PRO
2
1.3k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
New Earth Scene 8
popppiees
3
2.5k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
290
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
500
Building the Perfect Custom Keyboard
takai
2
850
Fireside Chat
paigeccino
42
4k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
630
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