Android Data Binding layout_width and layout_height

前端 未结 6 697
情话喂你
情话喂你 2020-12-08 15:12

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

6条回答
  •  悲&欢浪女
    2020-12-08 15:37

    When data binding is used, we strip values from the XML. You can add a default value to be used when it is stripped to avoid the issue.

    see: http://developer.android.com/tools/data-binding/guide.html (bottom of the page).

    android:layout_height="@{loginVM.compact ? @dimen/verificationHeightCompact : @dimen/verificationHeightFull, default=wrap_content}"
    

提交回复
热议问题