className
答案 0 :(得分:0)
使用 setId()和 getId()方法。
for (int i = 0; i < child; i++) {
Log.e("ChildAt", "" + container.getChildAt(i));
View childView = container.getChildAt(i);
TextView tv1=(TextView)childView.findViewById(R.id.txt_parent_plus_id);
tv1.setId(i);
}
tv1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int id=tv1.getId();
Log.e("Clicked", "Clicked" + String.valueOf(id)));
}
});