I need to be able to dynamically set an EditText\'s height property. I am using data binding for other properties throughout my app, so I would love to be able to use data b
According to the discussion on Android issue tracker, it is impossible to set layout height or width with data binding without creating custom binding adapters:
https://code.google.com/p/android/issues/detail?id=180666
The binding adapter needed for setting view height would look like that:
@BindingAdapter("android:layout_height")
public static void setLayoutHeight(View view, int height) {
LayoutParams layoutParams = view.getLayoutParams();
layoutParams.height = height;
view.setLayoutParams(layoutParams);
}