Slide 1

Slide 1 text

Android Design Tools Nicolas Roard +NicolasRoard @camaelon

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Goals

Slide 4

Slide 4 text

Goals Visualize

Slide 5

Slide 5 text

Goals Visualize Create

Slide 6

Slide 6 text

Goals Visualize Create Easy

Slide 7

Slide 7 text

Goals Visualize Create Easy Efficiently

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Android Studio Designer

Slide 25

Slide 25 text

Android Studio Designer Layout Lib

Slide 26

Slide 26 text

Android Studio Designer Layout Lib Libraries

Slide 27

Slide 27 text

Android Studio Designer Layout Lib Libraries Project code & resources

Slide 28

Slide 28 text

Android Studio Designer Layout Lib Libraries Layout Handlers Project code & resources

Slide 29

Slide 29 text

Tools attributes • tools: • tools:ignore • tools:showIn • tools:layout • tools:listitem • tools:parentTag https://developer.android.com/studio/write/tool-attributes.html

Slide 30

Slide 30 text

Tools attributes • tools: • tools:ignore • tools:showIn • tools:layout • tools:listitem • tools:parentTag override attributes at design time https://developer.android.com/studio/write/tool-attributes.html

Slide 31

Slide 31 text

Tools attributes • tools: • tools:ignore • tools:showIn • tools:layout • tools:listitem • tools:parentTag override attributes at design time ignore specific lint issues https://developer.android.com/studio/write/tool-attributes.html

Slide 32

Slide 32 text

Tools attributes • tools: • tools:ignore • tools:showIn • tools:layout • tools:listitem • tools:parentTag override attributes at design time ignore specific lint issues shows this layout embedded in another one https://developer.android.com/studio/write/tool-attributes.html

Slide 33

Slide 33 text

Tools attributes • tools: • tools:ignore • tools:showIn • tools:layout • tools:listitem • tools:parentTag override attributes at design time ignore specific lint issues shows this layout embedded in another one which layout to use for a fragment https://developer.android.com/studio/write/tool-attributes.html

Slide 34

Slide 34 text

Tools attributes • tools: • tools:ignore • tools:showIn • tools:layout • tools:listitem • tools:parentTag override attributes at design time ignore specific lint issues shows this layout embedded in another one which layout to use for a fragment which layout for a list item https://developer.android.com/studio/write/tool-attributes.html

Slide 35

Slide 35 text

Tools attributes • tools: • tools:ignore • tools:showIn • tools:layout • tools:listitem • tools:parentTag override attributes at design time ignore specific lint issues shows this layout embedded in another one which layout to use for a fragment which layout for a list item define which layout to use as parent for merge tag https://developer.android.com/studio/write/tool-attributes.html

Slide 36

Slide 36 text

Useful shortcuts • to select a parent group • to switch between XML and Design mode • double-click on included elements

Slide 37

Slide 37 text

ConstraintLayout

Slide 38

Slide 38 text

Why

Slide 39

Slide 39 text

ConstraintLayout • Flat Layouts • Expressive Layouts • Visual Editor

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

Vertical LinearLayout

Slide 43

Slide 43 text

Vertical LinearLayout RelativeLayout Image Image

Slide 44

Slide 44 text

Vertical LinearLayout RelativeLayout Image Image Vertical LinearLayout

Slide 45

Slide 45 text

Vertical LinearLayout RelativeLayout Image Image Vertical LinearLayout TextView

Slide 46

Slide 46 text

Vertical LinearLayout RelativeLayout Image Image Vertical LinearLayout TextView Horizontal LinearLayout EditText TextView

Slide 47

Slide 47 text

Vertical LinearLayout RelativeLayout Image Image Vertical LinearLayout TextView Horizontal LinearLayout EditText TextView Horizontal LinearLayout EditText TextView

Slide 48

Slide 48 text

Vertical LinearLayout RelativeLayout Image Image Vertical LinearLayout TextView Horizontal LinearLayout EditText TextView Horizontal LinearLayout EditText TextView TextView

Slide 49

Slide 49 text

Vertical LinearLayout RelativeLayout Image Image Vertical LinearLayout TextView Horizontal LinearLayout EditText TextView Horizontal LinearLayout EditText TextView TextView Horizontal LinearLayout Button Button

Slide 50

Slide 50 text

Vertical LinearLayout RelativeLayout Image Image Vertical LinearLayout TextView Horizontal LinearLayout EditText TextView Horizontal LinearLayout EditText TextView TextView Horizontal LinearLayout Button Button

Slide 51

Slide 51 text

Vertical LinearLayout RelativeLayout Image Image Vertical LinearLayout TextView Horizontal LinearLayout EditText TextView Horizontal LinearLayout EditText TextView TextView Horizontal LinearLayout Button Button

Slide 52

Slide 52 text

Vertical LinearLayout RelativeLayout Image Image Vertical LinearLayout TextView Horizontal LinearLayout EditText TextView Horizontal LinearLayout EditText TextView TextView Horizontal LinearLayout Button Button

Slide 53

Slide 53 text

ConstraintLayout

Slide 54

Slide 54 text

ConstraintLayout Image Image TextView EditText TextView EditText TextView TextView Button Button

Slide 55

Slide 55 text

ConstraintLayout Image Image TextView EditText TextView EditText TextView TextView Button Button

Slide 56

Slide 56 text

What

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

Constraints

Slide 60

Slide 60 text

Constraints No Constraints…

Slide 61

Slide 61 text

Constraints

Slide 62

Slide 62 text

Constraints Vertical + Horizontal Constraints

Slide 63

Slide 63 text

Constraints

Slide 64

Slide 64 text

Constraints at least one horizontal one vertical

Slide 65

Slide 65 text

What • Small (130 Kb) • Unbundled Library • Flexible foundation • Direct Resolution • Linear System Solver

Slide 66

Slide 66 text

What • Small (130 Kb) • Unbundled Library • Flexible foundation • Direct Resolution • Linear System Solver Linear System Solver

Slide 67

Slide 67 text

What • Small (130 Kb) • Unbundled Library • Flexible foundation • Direct Resolution • Linear System Solver Linear System Solver Constraints System

Slide 68

Slide 68 text

What • Small (130 Kb) • Unbundled Library • Flexible foundation • Direct Resolution • Linear System Solver Linear System Solver Direct Resolution Constraints System

Slide 69

Slide 69 text

What • Small (130 Kb) • Unbundled Library • Flexible foundation • Direct Resolution • Linear System Solver Linear System Solver Direct Resolution Constraints System UI Builder

Slide 70

Slide 70 text

What • Small (130 Kb) • Unbundled Library • Flexible foundation • Direct Resolution • Linear System Solver Linear System Solver Direct Resolution Constraints System UI Builder Inference

Slide 71

Slide 71 text

1.0.2 • 16 updates since Google IO’16 • Faster! • New Features • Improved Visual Editor support • Default Layout in Android Studio

Slide 72

Slide 72 text

Constraints

Slide 73

Slide 73 text

Relative Positioning Chains Guidelines Gone Dimension Relative Positions

Slide 74

Slide 74 text

Relative Positioning Chains Guidelines Gone Dimension Relative Positions

Slide 75

Slide 75 text

Text Baseline Chains Guidelines Gone Dimension Relative Positions

Slide 76

Slide 76 text

Text Baseline Chains Guidelines Gone Dimension Relative Positions

Slide 77

Slide 77 text

Bias Chains Guidelines Gone Dimension Relative Positions

Slide 78

Slide 78 text

Bias Chains Guidelines Gone Dimension Relative Positions

Slide 79

Slide 79 text

Dimensions • wrap_content • match_constraint (0dp) • fixed size Chains Guidelines Gone Dimension Relative Positions

Slide 80

Slide 80 text

Dimensions • wrap_content • match_constraint (0dp) • fixed size android:layout_height=“wrap_content" android:layout_height="0dp" android:layout_height="42dp" Chains Guidelines Gone Dimension Relative Positions

Slide 81

Slide 81 text

Dimensions wrap match fixed Chains Guidelines Gone Dimension Relative Positions

Slide 82

Slide 82 text

Match Constraint • default behavior (spread vs wrap) • ratio • weights (in chains) • min & max Chains Guidelines Gone Dimension Relative Positions

Slide 83

Slide 83 text

Match Constraint : max Chains Guidelines Gone Dimension Relative Positions

Slide 84

Slide 84 text

Match Constraint : max Chains Guidelines Gone Dimension Relative Positions

Slide 85

Slide 85 text

Aspect Ratio Chains Guidelines Gone Dimension Relative Positions

Slide 86

Slide 86 text

Aspect Ratio Chains Guidelines Gone Dimension Relative Positions

Slide 87

Slide 87 text

Gone behavior Chains Guidelines Gone Dimension Relative Positions

Slide 88

Slide 88 text

Gone behavior Chains Guidelines Gone Dimension Relative Positions

Slide 89

Slide 89 text

Chains Guidelines Gone Dimension Relative Positions

Slide 90

Slide 90 text

Inadapted Margins? Chains Guidelines Gone Dimension Relative Positions

Slide 91

Slide 91 text

Chains Guidelines Gone Dimension Relative Positions

Slide 92

Slide 92 text

Gone Margins! Chains Guidelines Gone Dimension Relative Positions

Slide 93

Slide 93 text

Guidelines Chains Guidelines Gone Dimension Relative Positions

Slide 94

Slide 94 text

Guidelines Chains Guidelines Gone Dimension Relative Positions

Slide 95

Slide 95 text

Chains A B Chain bi-directional constraints Chains Guidelines Gone Dimension Relative Positions

Slide 96

Slide 96 text

Different Chain Styles A B C Spread A B C Spread Inside A B C Weighted A B C Packed Chains Guidelines Gone Dimension Relative Positions

Slide 97

Slide 97 text

Different Chain Styles A B C Spread A B C Spread Inside A B C Weighted A B C Packed + bias Chains Guidelines Gone Dimension Relative Positions

Slide 98

Slide 98 text

Chains Guidelines Gone Dimension Relative Positions

Slide 99

Slide 99 text

Chains Guidelines Gone Dimension Relative Positions

Slide 100

Slide 100 text

Constraint Layout Tools

Slide 101

Slide 101 text

Tools

Slide 102

Slide 102 text

Tools

Slide 103

Slide 103 text

Tools

Slide 104

Slide 104 text

Tools

Slide 105

Slide 105 text

Tools

Slide 106

Slide 106 text

Tools

Slide 107

Slide 107 text

Tools

Slide 108

Slide 108 text

Tools • Automatically makes constraints • Control for simple moving of views

Slide 109

Slide 109 text

Tools • Automatically makes constraints • Control for simple moving of views

Slide 110

Slide 110 text

Inference Automatically create constraints • Based on probability a model for connections • Constrains unconstrained views • Does not move views (not an alignment tool)

Slide 111

Slide 111 text

Inference Automatically create constraints • Based on probability a model for connections • Constrains unconstrained views • Does not move views (not an alignment tool)

Slide 112

Slide 112 text

Animation

Slide 113

Slide 113 text

Animation

Slide 114

Slide 114 text

Animation

Slide 115

Slide 115 text

ConstraintSet

Slide 116

Slide 116 text

ConstraintSet ConstraintSet mConstraintSet1 = new ConstraintSet(); // create a Constraint Set ConstraintSet mConstraintSet2 = new ConstraintSet(); // create a Constraint Set

Slide 117

Slide 117 text

ConstraintSet ConstraintSet mConstraintSet1 = new ConstraintSet(); // create a Constraint Set ConstraintSet mConstraintSet2 = new ConstraintSet(); // create a Constraint Set mConstraintSet2.clone(context, R.layout.state2); // get constraints from layout setContentView(R.layout.state1); mConstraintLayout = (ConstraintLayout) findViewById(R.id.activity_main); mConstraintSet1.clone(mConstraintLayout); // get constraints from ConstraintSet

Slide 118

Slide 118 text

ConstraintSet ConstraintSet mConstraintSet1 = new ConstraintSet(); // create a Constraint Set ConstraintSet mConstraintSet2 = new ConstraintSet(); // create a Constraint Set mConstraintSet2.clone(context, R.layout.state2); // get constraints from layout setContentView(R.layout.state1); mConstraintLayout = (ConstraintLayout) findViewById(R.id.activity_main); mConstraintSet1.clone(mConstraintLayout); // get constraints from ConstraintSet TransitionManager.beginDelayedTransition(mConstraintLayout); mConstraintSet1.applyTo(mConstraintLayout);

Slide 119

Slide 119 text

• Programmatically change individual parameters • Use TransitionManager to smooth animation Individual View Animation

Slide 120

Slide 120 text

• Programmatically change individual parameters • Use TransitionManager to smooth animation Individual View Animation

Slide 121

Slide 121 text

• Programmatically change individual parameters • Use TransitionManager to smooth animation Individual View Animation //Find the view you are over and set minimum height TransitionManager.beginDelayedTransition(myConstraintLayout); View child = myConstraintLayout.getChildAt(current); child.setMinimumHeight(400);

Slide 122

Slide 122 text

A few examples…

Slide 123

Slide 123 text

Row

Slide 124

Slide 124 text

Row

Slide 125

Slide 125 text

Tip: tools attributes tools:listitem=“@layout/row” https://developer.android.com/ studio/write/tool-attributes.html

Slide 126

Slide 126 text

No content

Slide 127

Slide 127 text

No content

Slide 128

Slide 128 text

No content

Slide 129

Slide 129 text

No content

Slide 130

Slide 130 text

No content

Slide 131

Slide 131 text

How it works • Vertical Chain, packed • ImageView with height=0dp • ImageView with default height behavior to “wrap”

Slide 132

Slide 132 text

How it works • Vertical Chain, packed • ImageView with height=0dp • ImageView with default height behavior to “wrap”

Slide 133

Slide 133 text

No content

Slide 134

Slide 134 text

No content

Slide 135

Slide 135 text

How it works • Horizontal Chain, packed • Bias to 0 • Resizable element set to default=wrap

Slide 136

Slide 136 text

Dialog

Slide 137

Slide 137 text

Dialog

Slide 138

Slide 138 text

Landscape

Slide 139

Slide 139 text

Rotation

Slide 140

Slide 140 text

Rotation

Slide 141

Slide 141 text

Animation…

Slide 142

Slide 142 text

Animation…

Slide 143

Slide 143 text

• | 2 layouts

Slide 144

Slide 144 text

Custom Animations • ConstraintSet • Custom TransitionSet • Support library physics

Slide 145

Slide 145 text

Custom Animations • ConstraintSet • Custom TransitionSet • Support library physics

Slide 146

Slide 146 text

What’s next • Android Studio 2.4 • default RTL support in ConstraintLayout editor • Component Tree • ConstraintLayout 1.1 • Barriers • Groups

Slide 147

Slide 147 text

Barriers • “min” and “max” for constraints • implemented as a virtual helper

Slide 148

Slide 148 text

Barriers • “min” and “max” for constraints • implemented as a virtual helper

Slide 149

Slide 149 text

Groups • Apply operations on a group of widget • opacity • translate • elevation • visibility

Slide 150

Slide 150 text

Component Tree

Slide 151

Slide 151 text

Slice Editor

Slide 152

Slide 152 text

Slice Editor

Slide 153

Slide 153 text

Slice Editor

Slide 154

Slide 154 text

Slice Editor

Slide 155

Slide 155 text

Fin

Slide 156

Slide 156 text

Contact Nicolas Roard @camaelon +NicolasRoard John Hoford @johnhoford +johnhoford Documentation https://developer.android.com/ reference/android/support/constraint/ package-summary.html File Bugs! http://b.android.com