I want to set margins based on dimensions i have created in dimens.xml The dimensions it sself works fine, its just data binding cant find it in the case below:
<
Almost the same solution, but using Kotlin:
In file BindingAdapters.kt add:
@BindingAdapter("layoutMarginBottom")
fun setLayoutMarginBottom(view: View, dimen: Float) {
view.updateLayoutParams {
bottomMargin = dimen.toInt()
}
}
Usage in layout:
You can write similar method for top
, start
, end
margins.