Advertisement
Pit_Anonim

Untitled

Apr 16th, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. while (true) {
  2. ArrayList<String> cardText = new ArrayList<>();
  3.  
  4. while (i < text.length) {
  5. cardText.add(text[i]);
  6. if(text[i].substring(0, 1).equals("-")){
  7. break;
  8. }
  9. i++;
  10. }
  11.  
  12. textView = new TextView(this);
  13. textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
  14. ViewGroup.LayoutParams.WRAP_CONTENT));
  15. textView.setTextSize(convertDpToPixel(6, this));
  16. textView.setTextColor(Color.BLACK);
  17. textView.setBackgroundResource(R.drawable.rectangle);
  18. textView.setText(cardText.get(0));
  19.  
  20. CardView card = new CardView(this);
  21. card.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
  22. ViewGroup.LayoutParams.WRAP_CONTENT));
  23. card.setUseCompatPadding(true);
  24. card.addView(textView);
  25.  
  26. for (int b = 1; b < cardText.size(); b++) {
  27. textView = new TextView(this);
  28. textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
  29. ViewGroup.LayoutParams.WRAP_CONTENT));
  30. textView.setTextSize(convertDpToPixel(6, this));
  31. textView.setTextColor(Color.BLACK);
  32. textView.setBackgroundResource(R.drawable.some_rectangle);
  33. textView.setText(cardText.get(b));
  34.  
  35.  
  36. card.addView(textView);
  37. }
  38. menu.addView(card);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement