setVisibleIfNotNull
Sets the visibility of the View based on whether the instance is null
. If the instance is null
, the visibility is set to View.VISIBLE. If the instance is null
, it is set to View.GONE.
This adapter allows replacing
<View
android:visibility="@{viewModel.instance != null ? View.VISIBLE : View.GONE}" />
Content copied to clipboard
with
<View
auto:visibleIfNotNull="@{viewModel.instance}" />
Content copied to clipboard