With Android's new Databinding library, you can write inline expressions within your xml layout. For example, you can set the visibility of a view as such:
<TextView
android:text="@{user.lastName}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="@{user.isAdult ? View.VISIBLE : View.GONE}"/>
How do I go about unit/layout testing this? I want to make sure that the visibility correctly toggles when user.isAdult is true and false.
Aucun commentaire:
Enregistrer un commentaire