在Android中你可以使用findViewById()来查找动态添加的控件吗?
以类似的方式添加到:
Button btn=new Button(this);
btn.setId(1);
btn.setBackgroundResource(R.drawable.image);
Relativelayout.addView(btn);
由于
答案 0 :(得分:0)
你可以用这个:
//view.findViewById(id); here pass the same id which you have set earlier for a particular view, while adding view to layout/view.
Button btn = (Button) relativeLayout.findViewById(1);