问题描述
您好,我创建了一个带有动态行的表格布局。现在我想对表格布局行应用过滤器。
任何人都可以帮助我如何实现这一目标。 代码描述了来自服务器的动态渲染数据。现在我的数据正确呈现 现在想应用以下数据进行过滤。
Java:
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());
private void getRegisteredPatientList() {
progressDialog = new ProgressDialog(getContext());
progressDialog.setIndeterminate(true);
progressDialog.setMessage("Loading...");
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setCancelable(false);
progressDialog.show();
String hospital_id = "PH:193";
final APIService service = RetroClass.getRetrofitInstance().create(APIService.class);
Call<GetRegisterdPatient> call = service.gestRegisterdPatient(hospital_id);
Log.wtf("URL Called",call.request().url() + "");
call.enqueue(new Callback<GetRegisterdPatient>() {
@Override
public void onResponse(Call<GetRegisterdPatient> call,Response<GetRegisterdPatient> response) {
Log.e("response",new Gson().toJson(response.body()));
if (response.isSuccessful()) {
Log.e("response",new Gson().toJson(response.body()));
GetRegisterdPatient getRegisterdPatient = response.body();
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++) {
tbrow = new TableRow(getContext());
tbrow.setClickable(true);
tbrow.setLayoutParams(getLayoutParams());
// tbrow.addView(getTextView(i+numSlots,String.valueOf(i),Color.BLACK,ContextCompat.getColor(getContext(),R.color.back_blue)));
tbrow.addView(getTextView(i + numSlots,RegistratonList[i],Fnamelist[i].concat(" ").concat(Lnamelist[i]),Mobilelist[i],R.color.back_blue)));
tbrow.setTag("patientlist");
stk.addView(tbrow);
}
}
}
progressDialog.dismiss();
}
@Override
public void onFailure(Call<GetRegisterdPatient> call,Throwable t) {
Log.d("error",t.getMessage());
progressDialog.dismiss();
}
});
}
@NonNull
private TableRow.LayoutParams getLayoutParams() {
TableRow.LayoutParams params = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT,TableRow.LayoutParams.WRAP_CONTENT);
params.setMargins(1,1,1);
return params;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)