我试图从布局中删除单个视图,但它没有被删除。
但是,当我打电话给removeAll
时,它会将它们全部删除。
以下是代码:
for (int subspe = 0; subspe < totalSubSpe; subspe++) {
View childSubSpe =
BasicInfoUpdateDocProfile.ll_custom_for_supspecialist.getChildAt(subspe);
TextView subSpecialityId = (TextView) childSubSpe.findViewById(R.id.tv_speciality_id);
TextView specialistId = (TextView) child.findViewById(R.id.tv_id);
String speID = specialistId.getText().toString();
String subSepId = subSpecialityId.getText().toString();
Log.e("TAG", "the the the the id is: speciality " + speID);
Log.e("TAG", "the the the the id is: sub speiciality " + subSepId);
if (speID.equals(subSepId)) {
//removing sub qualificaiton
Log.e("TAG", "It is Equal subspecialist ");
ViewGroup par = (ViewGroup) childSubSpe.getParent();
par.removeView(childSubSpe);
//BasicInfoUpdateDocProfile.ll_custom_for_supspecialist.removeView(childSubSpe);
BasicInfoUpdateDocProfile.ll_custom_for_supspecialist.
removeView((View)childSubSpe.getParent());
// BasicInfoUpdateDocProfile.ll_custom_for_supspecialist.removeAllViews();
}
}