Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. attr_layout[i].addView(radioButton, lp);
  2.  
  3. `LinearLayout[] attr_layout = new LinearLayout[optionsList.size()];
  4. attr_layout[i] = new LinearLayout(mMain);
  5. attr_layout[i].setOrientation(LinearLayout.HORIZONTAL);
  6.  
  7. int attr_size = attributes.size();
  8.  
  9. for (int k = 0; k < attr_size; k++)
  10. {
  11. String price = String.format(Locale.ENGLISH, AppConstants.DECIMAL_POINTS, Float.parseFloat(attributes.get(k).getAttr_price()));
  12. String name_price = attributes.get(k).getAttr_name()
  13. +" ("+ mMain.getString(R.string.currency_code)
  14. +" "+ price +")";
  15.  
  16. if(!multiSelect.equals("1")) // This multiselect value 1 and 0 is coming from database.
  17. //Based on these value, app will display checkbox or radio button
  18. {
  19. final RadioButton radioButton = new RadioButton(mMain);
  20. radioButton.setText(name_price);
  21. radioButton.setId(i + 6);
  22. radioButton.setTextSize(12);
  23. radioButton.setTag(attributes.get(k));
  24. radioButton.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
  25. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
  26. {
  27. radioButton.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
  28. }
  29. setTextFont(radioButton, "Museo_Slab.otf");
  30.  
  31. LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
  32. LinearLayout.LayoutParams.MATCH_PARENT,
  33. LinearLayout.LayoutParams.WRAP_CONTENT,
  34. 1f);
  35. //lp.setMargins(10, 10, 0, 10); // llp.setMargins(left, top, right, bottom);
  36.  
  37.  
  38. RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);
  39. radioGroup.setLayoutParams(params);
  40. attr_layout[i].addView(radioButton, lp);`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement