我是 android 编程新手。
我想知道是否可以将我在 java 类中创建的 ID 生成到 r.java
我要生成的 ID 是 nBtnLayoutlist。
public class classABC extends Activity {
private int nBtnLayoutlist = 20;
private OnClickListener onClick() {
return new OnClickListener() {
public void onClick(View v) {
nBtnLayout = (LinearLayout)findViewById(R.id.nBtnLayoutList);
}
};
}
private LinearLayout newBtnLayout(){
LinearLayout nBtnLayout = new LinearLayout(this);
final LayoutParams lparams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
nBtnLayout.setOrientation(LinearLayout.VERTICAL);
nBtnLayout.setLayoutParams(lparams);
nBtnLayout.setWeightSum(100);
nBtnLayout.setId(nBtnLayoutList);
return nBtnLayout;
}