setVisibleIf
Sets the visibility of the View based on whether the condition is satisfied. If the condition is satisfied (true
), the visibility is set to View.VISIBLE. Otherwise, it is set to View.GONE. If condition is null
, it is set to View.GONE.
This adapter allows replacing
<View
android:visibility="@{viewModel.condition ? View.VISIBLE : View.GONE}" />
Content copied to clipboard
with
<View
auto:visibleIf="@{viewModel.condition}" />
Content copied to clipboard