M
M
madm0nkey2015-05-15 12:13:43
Java
madm0nkey, 2015-05-15 12:13:43

How to get individual rows from an array?

Hello. The application needs to break the string into words and display the words on the screen in separate TextViews. Tell me how to do it? I split the phrase using split(" ") by space, I get an array of words, then I need to put each one in a separate TextView (and put all the textView in a RelativeLayout, for example, placed in the markup), I don’t understand how to implement this yet ...

String[] words = phrase.split(" ");
        
rl2 = (RelativeLayout) findViewById(R.id.rl2);

I am posting a prototype screen for clarity. Words must be placed at the bottom of the screen (and later dragged to the top by the user)
7231f83cf150431fa4628bbf7c826389.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Yakushev, 2015-05-15
@madm0nkey

Use GridView . And create a TextView programmatically:

  1. First split the string into an array
  2. Then randomly mix it up.
  3. For each array element with a word, we create a TextView programmatically and add it to our GridView

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question