Advertisement
Sketchware

Cores randomicas no limear

Jan 21st, 2023
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. final LinearLayout linear1 = findViewById(R.id.linear1);
  2. final Random random = new Random();
  3. linear1.setOnClickListener(new View.OnClickListener() {
  4.     @Override
  5.     public void onClick(View view) {
  6.         int color = Color.argb(255, random.nextInt(256), random.nextInt(256), random.nextInt(256));
  7.         linear1.setBackgroundColor(color);
  8.     }
  9. });
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement