Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (true) {
- ArrayList<String> cardText = new ArrayList<>();
- while (i < text.length) {
- cardText.add(text[i]);
- if(text[i].substring(0, 1).equals("-")){
- break;
- }
- i++;
- }
- textView = new TextView(this);
- textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.WRAP_CONTENT));
- textView.setTextSize(convertDpToPixel(6, this));
- textView.setTextColor(Color.BLACK);
- textView.setBackgroundResource(R.drawable.rectangle);
- textView.setText(cardText.get(0));
- CardView card = new CardView(this);
- card.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.WRAP_CONTENT));
- card.setUseCompatPadding(true);
- card.addView(textView);
- for (int b = 1; b < cardText.size(); b++) {
- textView = new TextView(this);
- textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.WRAP_CONTENT));
- textView.setTextSize(convertDpToPixel(6, this));
- textView.setTextColor(Color.BLACK);
- textView.setBackgroundResource(R.drawable.some_rectangle);
- textView.setText(cardText.get(b));
- card.addView(textView);
- }
- menu.addView(card);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement