μ€λ₯ λ°μ
Databinding + ViewModel + LiveData
λ‘ κ°λ¨ν MVVM
μμ λ₯Ό ꡬννκΈ° μν΄ Databinding
μΌλ‘ ννν λ³μ(?)λ₯Ό layout
μμ <data>
λΈλμ λ£μ΄μ€¬λλ λ°μν μ€λ₯
μ€λ₯ λ΄μ©
ν΄κ²°
String
μΌλ‘ λ³ννμ§ μμμ λ°μν λ¬Έμ ... γ
γ
γ
γ
γ
... toString()
μ ν΄μ€¬λλ μ μμ μΌλ‘ μλνλ€.
<TextView
android:id="@+id/displayNumberTextView"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginHorizontal="18dp"
android:gravity="center"
android:text="@{bindingMainViewModel.getNumber().toString()}"
android:textSize="50sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />