java - 用于表格布局的 android 中的 ID 没有增加
问题描述
在下面的代码中,我动态显示从 1 开始的 ID 编号。但每次它只显示1。
谁能帮我解决这个问题?
for (GetRegisterdPatientListData getRegisterdPatientListData:getRegisterdPatientListDataArrayList) {
RegistrationNo = getRegisterdPatientListData.getRegistrationNo();
FName = getRegisterdPatientListData.getFName();
LName = getRegisterdPatientListData.getLName();
Mobile = getRegisterdPatientListData.getMobile();
String[] RegistratonList = RegistrationNo.split(",");
String[] Fnamelist = FName.split (",");
String[] Lnamelist = LName.split (",");
String[] Mobilelist = Mobile.split (",");
numSlots = RegistratonList.length;
for (int i = 0; i < numSlots; i++) {
TableRow tbrow = new TableRow(getContext());
tbrow.setLayoutParams(getLayoutParams());
tbrow.addView(getTextView(i + numSlots, string.valueOf(i + 1), Color.BLACK, ContextCompat.getColor(getContext(), R.color.back_blue)));
tbrow.addView(getTextView(i + numSlots, RegistratonList[i], Color.BLACK, ContextCompat.getColor(getContext(), R.color.back_blue)));
tbrow.addView(getTextView(i + numSlots, Fnamelist[i].concat(" ").concat(Lnamelist[i]), Color.BLACK, ContextCompat.getColor(getContext(), R.color.back_blue)));
tbrow.addView(getTextView(i + numSlots, Mobilelist[i], Color.BLACK, ContextCompat.getColor(getContext(), R.color.back_blue)));
stk.addView (tbrow);
}
}
解决方案
推荐阅读
- aframe - 实体的定向音频
- javascript - 创建自定义 EventEmitter 时不需要调用 .emit 吗?
- processing - 在 P5.js 中使用 loadBytes 的奇怪行为
- java - Java - ServiceLoader - Intellij 找不到实现类文件
- python - Python - 在where子句中动态传递产品名称
- python-3.x - 在新的 python 程序文件中从套接字编程中读取客户端文件的结果
- r - 在 tibble 的不同级别应用函数
- firebase - React Native with Firebase:任何人都可以看到电子邮件格式不正确的地方吗?
- rdf - 如何使用任何 owl 本体映射大型数据文件
- python - sklearn learning_curve 和 StandardScaler