Skip to content

Instantly share code, notes, and snippets.

@SeongUgJung
Last active August 27, 2018 15:37
Show Gist options
  • Save SeongUgJung/4a7c1f79ae88832eee4c7a9c3d2f1737 to your computer and use it in GitHub Desktop.
Save SeongUgJung/4a7c1f79ae88832eee4c7a9c3d2f1737 to your computer and use it in GitHub Desktop.
Custom View setter 이용
class RoundImageView : ImageView {
private radious : Int
fun setRadious(rad : Int) {
this.radious = rad
}
// 이하 생략
}
class MainViewModel {
val imageRadious = ObservableInt()
init {
imageRadious.set(10)
}
}
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
>
<data>
<variable
name="vm"
type="MainViewModel"
/>
</data>
<custom.RoundImageView
android:layout_width="50dp"
android:layout_height="50dp"
app:radious="@{vm.imageRadious}"
/>
/layout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment