Is it possible to create an expression for data binding and control the visibility of a view element using enumerations? I want to achieve the following
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="@{user.editType == EditType.EDIT_PROFIL ? View.VISIBLE : View.GONE}">
The EditType class is very simple.
public enum EditType {
NONE,
EDIT_PROFIL,
EDIT_ADDRESSES; }
It would be great if I could use this enumeration in XML to control my visibility LinearLayout.
Has anyone understood how to achieve this?
source
share