问题描述
我正在从服务器获取数据并为该响应动态创建表格布局,现在我每页只需要显示 5 行,想要显示如下页码。如果点击下面的按钮编号想要显示 6 到 10 行.
如何实现这一点,任何人都可以帮助我
TableLayout.java:
stk =rootView.findViewById(R.id.tables);
next=rootView.findViewById(R.id.next);
TableRow tbrow0 = new TableRow(getContext());
Resources resource = getContext().getResources();
tbrow0.setLayoutParams(getLayoutParams());
tbrow0.addView(getTextView(0,"ID",Color.WHITE,resource.getColor(R.color.theme)));
tbrow0.addView(getTextView(0,"Reg No.","Name","Mobile No.",resource.getColor(R.color.theme)));
stk.addView(tbrow0,getLayoutParams());
ArrayList<GetRegisterdPatientListData> getRegisterdPatientListDataArrayList=getRegisterdPatient.getData();
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.setTag(i);
tbrow.setLayoutParams(getLayoutParams());
tbrow.addView(getTextView(i + numSlots,RegistratonList[i],Color.BLACK,ContextCompat.getColor(getContext(),R.color.back_blue)));
tbrow.addView(getTextView(i + numSlots,Fnamelist[i],Lnamelist[i],Mobilelist[i],R.color.back_blue)));
if(i<6){
tbrow.setVisibility(View.VISIBLE);
}else {
tbrow.setVisibility(View.GONE);
}
stk.addView(tbrow);
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)