-
-
Save marconvcm/1b14162cd0e16c900d8b787cfea7732c to your computer and use it in GitHub Desktop.
Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
linearLayout = findViewById(R.id.linearLayout); | |
Random random = new Random(); | |
for (int i = 0; i < 100; i++) { | |
TextView red = new TextView(this); | |
red.setText("Hello"); | |
red.setTextSize(30); | |
red.setBackgroundColor( | |
Color.rgb(155 + i, i, 0)); | |
TextView blue = new TextView(this); | |
blue.setText("World"); | |
blue.setBackgroundColor( | |
Color.rgb( | |
random.nextInt(255), 255 - i, 155 + i)); | |
blue.setTextSize(30); | |
linearLayout.addView(red, | |
LinearLayout.LayoutParams.MATCH_PARENT); | |
linearLayout.addView(blue, | |
LinearLayout.LayoutParams.MATCH_PARENT); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment