通过标签访问图像视图

问题描述:

我正在创建3个线性布局(水平)的Android项目,每个布局都有一些图像视图。我还为每个图像视图分配了标签。 我如何通过标签访问每个图像视图。 我想访问它来检查图像视图的不同条件。通过标签访问图像视图

+0

欢迎堆栈溢出,请花时间去通过[欢迎参观(https://*.com/tour)知道在这里(也赚你的第一个徽章)的方式,阅读如何[创建一个最小化,完整和可验证的示例](https://*.com/help/mcve),并检查[如何提出好问题](https://*.com/help/how-问),所以你增加了获得反馈和有用答案的机会。 –

标签不用于识别的意见,所以你不能用它直接识别的观点(https://developer.android.com/reference/android/view/View.html

您需要首先获取父。

LinearLayout linearLayout = (LinearLayout)findViewById(R.id.ll_layout_1); 
ImageView imageView = (ImageView) linearLayout.findViewWithTag("imageTag"); 
+0

Thankssssssss :) – Manu