动态生成控件,想给它设置一个id
Button bt = new Button(activity);
发现
bt.setId(int id)
参数是个int
问题:
像在c#中,直接就是bt.id="bt1" 就是了。
android里面怎么给动态生成的控件一个id呢?这里的setId参数是个int,这是设置id么?后面用findViewById怎么得到这个引用呢?多谢指点。
Button bt = new Button(activity);
发现
bt.setId(int id)
参数是个int
问题:
像在c#中,直接就是bt.id="bt1" 就是了。
android里面怎么给动态生成的控件一个id呢?这里的setId参数是个int,这是设置id么?后面用findViewById怎么得到这个引用呢?多谢指点。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货