When inflating a layout xml dynamically multiple times, how can I differentiate or identify the Button widgets?

前端 未结 3 1327
庸人自扰
庸人自扰 2021-01-18 00:36

I am inflating an xml having button, multiple times and i am able to do so perfectly but the problem is when I click the button,i want to show which button is clicked.

3条回答
  •  误落风尘
    2021-01-18 00:56

    Use the view tag

    View.setTag(Object tag);

    You can set a string or a complex object like a class to the tag.

提交回复
热议问题