Skip to content

Instantly share code, notes, and snippets.

@marconvcm
Created November 18, 2019 21:46
Show Gist options
  • Save marconvcm/1b14162cd0e16c900d8b787cfea7732c to your computer and use it in GitHub Desktop.
Save marconvcm/1b14162cd0e16c900d8b787cfea7732c to your computer and use it in GitHub Desktop.
Android
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