Is there any way to change the visibility of a button to gone?
I have tried the following code.
<TextView
android:id="@+id/order_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="@dimen/text_size_extra_larger"
android:layout_gravity="center_horizontal|center_vertical"
android:gravity="center"
tools:text="Amount" />
<Button
android:id="@+id/clear_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_weight="1"
android:background="@android:color/transparent"
android:text="@string/clear"
android:textAllCaps="true"
android:textColor="@android:color/white"
android:textSize="@dimen/text_size_normal"
android:visibility='@={orderAmount.getText().equals("0.0") ? View.GONE : View.VISIBLE}' />
I want to make the clear_button
disappear when the text in the order_amount
is "0.0".
I want to accomplish this using data binding expressions only.