Je souhaite spécifier une relation entre deux vues dans mon fichier de mise en page XML Android. Voici ce que je veux faire:Android XML: Définir l'ID de ressource en tant que balise View dans le fichier de mise en page XML
<View
android:id="@+id/pathview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
...
<CheckBox
android:id="@+id/viewPath"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true"
android:paddingRight="7dp"
android:shadowColor="#000000"
android:shadowDx="0.5"
android:shadowDy="0.5"
android:shadowRadius="0.5"
android:tag="@id/pathview"
android:text="Paths" />
Cependant, l'analyseur XML traite l'étiquette comme une chaîne et ne pas interpréter comme un entier (System.out.println((String) [viewPath].getTag());
affiche « false »). Est-il possible d'attribuer l'ID de ressource à la balise View?
http://stackoverflow.com/questions/5100381/how-to-set-an-array-as-tag-to-any-view-through-layout-xml-in-android –