I'm using Android DataBinding and looking for a way to get references to a/set view(s) from the ViewDataBinding instance.
I'm looking for a way to find view(s) by a unique identifier, in this code below, is it possible to get all the views that have the same tag "MYTAG" in xml from my data binding instance(in Activity,Fragment class)?
android:tag="MYTAG"
My Actual use case is, that I need to know all the views that have the 'android:transitionName' attribute set in xml to make Scene Transition Animation (where I need to pass all the shared views and TransitionName in Bundle options when start new start activity which going to animate)
Currently Im using findViewById() to get all the interested views but I'm looking for a way to archive the same by just using data-binding without manully finding view by it's IDs
This is my xml layout :
`
<data>
<variable name="item" type="demo.com.entities.Recommendation" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
>
<ImageView
android:id="@+id/room_card_icon"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scaleType="fitXY"
app:layout_constraintBottom_toTopOf="@+id/guide75"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/tour_placeholder"
android:transitionName="@{item.uid}"
app:imageUrl="@{item.image}"
android:tag="MYTAG"
/>
<TextView
android:id="@+id/title_recommendations"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@+id/room_card_icon"
app:layout_constraintStart_toStartOf="parent"
android:transitionName="@{`title`+item.uid}"
android:text="@{item.poi.name}"
tools:text="The Southern Ridges"
android:tag="MYTAG"
/>
<TextView
android:id="@+id/typeTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/title_recommendations"
app:layout_constraintStart_toStartOf="@+id/title_recommendations"
android:transitionName="@{`Category`+item.uid}"
android:text="@{item.poi.dataset}"
tools:text="Attractions"
android:tag="MYTAG" />
<TextView
android:id="@+id/descriptionTV"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/guide75"
android:text="@{item.recommendation}"
tools:text="A magical place in nature. Take a morning walk or go for a sunset walk" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guide75"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.75" />
</androidx.constraintlayout.widget.ConstraintLayout>
`
Thank you in advance!