我想在我的Android 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" />
然而,XML解析器将标签视为字符串,而不是将其解释为整数(System.out.println((String) [viewPath].getTag());
输出“false”)。有没有办法将资源ID分配给View的标签?