Advertisement
LemmyNjaria

Dynamic Edittext

Jul 17th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.40 KB | None | 0 0
  1.  for (i = 0; i < checkoutItemsList.size(); i++) {
  2.                /* lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
  3.                 lp.setMargins(30, 50, 30, 0);*/
  4.             productNames += checkoutItemsList.get(i).getCustomersBasketProduct().getProductsName();
  5.             for (j = 1; j <= getCartSize(); j++) {
  6.  
  7.                 lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
  8.                 lp.setMargins(30, 50, 30, 0);
  9.  
  10.                 //candidates name starts here
  11.                 candidatesNamesTv = new TextView(getActivity());
  12.                 candidatesNamesTv.setId(R.id.candidatesnametv);
  13.                 candidatesNamesTv.setText("" + productNames + "(" + j + ")");
  14.                 candidatesNamesTv.setTextSize(16);
  15.                 candidatesNamesTv.setTextColor(getResources().getColor(R.color.textColorSecondaryDark));
  16.                 candidatesNamesTv.setLayoutParams(lp);
  17.                 allcandidatesNamesTv.add(candidatesNamesTv);
  18.                 //Textview ends here
  19.  
  20.                 //candidates names ends here
  21.                 Drawable img = getContext().getResources().getDrawable(R.drawable.ic_person);
  22.                 img.setBounds(0, 0, 60, 60);
  23.                 candidatesNames = new AppCompatEditText(getActivity());
  24.                 candidatesNames.setBackgroundResource(R.drawable.rounded_corners_edittext_dark);
  25.                 candidatesNames.setId(R.id.candidatesname);
  26.                 candidatesNames.setHint("Candidate Full Name");
  27.                 candidatesNames.setHintTextColor(getResources().getColor(R.color.textColorPrimaryDark));
  28.                 candidatesNames.setTextColor(getResources().getColor(R.color.textColorSecondary));
  29.                 candidatesNames.setCompoundDrawables(img, null, null, null);
  30.                 candidatesNames.setCompoundDrawablePadding(20);
  31.                 candidatesNames.setFilters(new InputFilter[]{new InputFilter.AllCaps()});
  32.                 candidatesNames.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
  33.                 candidatesNames.setLayoutParams(lp);
  34.                 allCandidatesnames.add(candidatesNames);
  35.  
  36.  
  37.                 theLayout.addView(candidatesNamesTv);
  38.                 theLayout.addView(candidatesNames);
  39.                
  40.             }
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement