06-18 13:36
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 용산 호반써밋 에이디션
- 새마을금고
- ios
- arm-linux-androideabi
- JetPack
- 사전청약
- Swift
- Android Studio
- Android
- EditText
- Mac
- 3rd framework
- 청약
- Data Binding
- KB
- ndk r24
- MG더뱅킹정기예금
- CHAT GPT
- kotlin
- RETROFIT
- java
- 고금리
- ndkVersion
- ChatGPT
- audio record
- Andorid
- gradle
- BindingAdapter
- 예금
- 달러예금
Archives
- Today
- Total
pear
[android]data binding 4 - app custom attribute 본문
viewmodel
private val _num = MutableLiveData(0)
var num: LiveData<Int> = _num
bindingadapter
object CustomBindingAdapter{
@JvmStatic
@BindingAdapter("text_int")
fun setText(view: TextView, text: Int){
view.text = text.toString()
}
@JvmStatic
@InverseBindingAdapter(attribute = "text_int", event = "android:textAttrChanged")
fun getText(view: TextView): Int {
return view.text.toString().toIntOrNull() ?: 0
}
}
layout
<EditText
app:text_num='@={viewmodel.num}'
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
[android]data binding 5 - mistake error
'android > kotlin' 카테고리의 다른 글
[android] viewmodel binding implementation (0) | 2023.07.11 |
---|---|
[android]data binding 5 - mistake error (0) | 2023.06.01 |
[android]data binding 1 - simple example EditText (0) | 2023.06.01 |
[android]data binding 2 - BindingAdapter example EditText (0) | 2023.06.01 |
[android]data binding 3 - Two-way data binding & BindingAdapter example EditText (0) | 2023.06.01 |