例如你的main.xml中有一个button,id为button1,你可以通过以下方式去获得这个button的id。
getResources().getIdentifier(“button1,”id”,getPackageName());
这种方法适合批量找id或者drawable等资源。
例如你的main.xml中有一个button,id为button1,你可以通过以下方式去获得这个button的id。
getResources().getIdentifier(“button1,”id”,getPackageName());
这种方法适合批量找id或者drawable等资源。