layout xml? try Anko!

5f533179da1c82722252cbcb93e7356f?s=47 Moyuru Aizawa
December 09, 2016

layout xml? try Anko!

Shibuya.apk
Ankoについての発表

TwitterID変えました。@lvla0805 -> @MoyuruAizawa

5f533179da1c82722252cbcb93e7356f?s=128

Moyuru Aizawa

December 09, 2016
Tweet

Transcript

  1. 5.

    JU`TIBSEMZEPOFCFDBVTFJU`TTPNFXIBUVHMZBOEIBSEUPNBJOUBJO 8IJMFZPVDBODSFBUF6*QSPHSBNNBUJDBMMZʜ val act = this val layout = LinearLayout(act)

    layout.orientation = LinearLayout.VERTICAL val name = EditText(act) val button = Button(act) button.text = "Say Hello" button.setOnClickListener { Toast.makeText(act, "Hello, ${name.text}!", Toast.LENGTH_SHORT)
 .show() } layout.addView(name) layout.addView(button)
  2. 13.

    5IFSFJTOP fun Activity.verticalLayout(init: _LinearLayout.()->Unit): LinearLayout fun ViewManager.button(text: CharSequence?, init: Button.()->Unit):

    Button verticalLayout { val name = editText() button("Say Hello") { onClick { toast("Hello, ${name.text}!") } } }
  3. 14.

    5IFUIJTLFZXPSEDPSSFTQPOETUP@-JOFBS-BZPVU 5IFSFJTOP fun Activity.verticalLayout(init: _LinearLayout.()->Unit): LinearLayout fun ViewManager.button(text: CharSequence?, init:

    Button.()->Unit): Button verticalLayout { val name = editText() button("Say Hello") { onClick { toast("Hello, ${name.text}!") } } }
  4. 15.

    5IFUIJTLFZXPSEDPSSFTQPOETUP#VUUPO 5IFSFJTOP fun Activity.verticalLayout(init: _LinearLayout.()->Unit): LinearLayout fun ViewManager.button(text: CharSequence?, init:

    Button.()->Unit): Button verticalLayout { val name = editText() button("Say Hello") { onClick { toast("Hello, ${name.text}!") } } }
  5. 19.