Last active
August 27, 2018 15:37
-
-
Save SeongUgJung/4a7c1f79ae88832eee4c7a9c3d2f1737 to your computer and use it in GitHub Desktop.
Custom View setter 이용
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RoundImageView : ImageView { | |
private radious : Int | |
fun setRadious(rad : Int) { | |
this.radious = rad | |
} | |
// 이하 생략 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainViewModel { | |
val imageRadious = ObservableInt() | |
init { | |
imageRadious.set(10) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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