Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Google I/O '18 Extended In Daejeon Part1

Google I/O '18 Extended In Daejeon Part1

pluulove (노현석)

August 04, 2018
Tweet

More Decks by pluulove (노현석)

Other Decks in Programming

Transcript

  1. Android Layouts Simple ۨ੉ইਓ਷ ઺୏ਵ۽ ҳࢿ ઺୏ਵ۽ ੋ೧ ࢿמ ޙઁо

    ߊࢤ Complex ۨ੉ইਓ਷ ࢎਊ ߂ ਬ૑о য۰਎ ࣻ ੓׮ ӝઓ ۨ੉ইਓ ಞ૘ӝ۽ח ࠗ੸੺
  2. Preview in I/O '16 1.0 in 2017 1.1 in 2018

    2.0-alpha1 in I/O '18 ConstraintLayout
  3. ConstraintLayout ੘਷ ௼ӝ, ߣٜ۽ ޘ੉૑ ঋ਷ ۄ੉࠳۞ܻ API Level 9

    ഐജ (99.99%) Ө਷ ҅க ҳઑܳ ਤ೧ ࢸ҅ػ ۨ੉ইਓ Android Studio ীࢲ ੘স оמ
  4. Why not RelativeLayout? ConstraintLayout੉ ؊ ъ۱ ؊ ݆੉ ಴അ, ੸਷

    ઺୏ ۄ੉࠳۞ܻ ഋక۽ ઁҕ Android Studio UI بҳܳ ઁҕ
  5. <RelativeLayout> <ImageView/> <ImageView/> <RelativeLayout> <TextView/> <LinearLayout> <TextView/> <RelativeLayout> <EditText/> </RelativeLayout>

    </LinearLayout> <LinearLayout> <TextView/> <RelativeLayout> <EditText/> </RelativeLayout> </LinearLayout> <TextView/> </RelativeLayout> <LinearLayout> <Button/> <Button/> </LinearLayout> </RelativeLayout>
  6. <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
  7. 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
  8. Added 1.1 Barrier References multiple widgets as input, and creates

    a virtual guideline based on the most extreme widget on the specified side
  9. 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) } }
  10. View ੗୓৬ যڌѱ Layout ೞחоܳ ܻ࠙ ConstraintLayout੉ о૑ח ઁডਸ ё୓ച

    ӝઓ ConstraintLayoutী ConstraintSetਸ ੸ਊ оמ ࠂࣻ੄ ConstraintSetਵ۽ ੹ജ оמ Layoutਸ Ү୓ೞח Ѫ੉ ইפ޲۽, Viewח Reload ೞ૑ ঋ਺ ConstraintSet
  11. 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()
  12. 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) } }
  13. Case 1 Title Sub Title View Required Title Sub Title

    Required View ConstraintLayout ConstraintLayout
  14. <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
  15. <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
  16. Case 3 View View Required Button > View Required Button

    > View ConstraintLayout ConstraintLayout
  17. 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>
  18. 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>
  19. ConstraintLayout Easily create User Interface Flexible layout Flat hierarchies UI

    Builder Back compatible starting from API 9 (99.99% of devices) Support library : ~160Kb