Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. Button negro, gris, cian, azul, verde, naranja, morado, rojo, rosa;
  2. @Override
  3. protected void onCreate(Bundle savedInstanceState) {
  4. super.onCreate(savedInstanceState);
  5. setContentView(R.layout.activity_main);
  6. Dibujar drawView = findViewById(R.id.dibujar);
  7. negro= findViewById(R.id.negro);
  8. gris= findViewById(R.id.gris);
  9. cian= findViewById(R.id.cian);
  10. azul= findViewById(R.id.azul);
  11. verde= findViewById(R.id.verde);
  12. naranja= findViewById(R.id.naranja);
  13. morado= findViewById(R.id.morado);
  14. rojo= findViewById(R.id.rojo);
  15. rosa= findViewById(R.id.rosa);
  16. negro.setOnClickListener(this);
  17. gris.setOnClickListener(this);
  18. cian.setOnClickListener(this);
  19. azul.setOnClickListener(this);
  20. verde.setOnClickListener(this);
  21. naranja.setOnClickListener(this);
  22. morado.setOnClickListener(this);
  23. rojo.setOnClickListener(this);
  24. rosa.setOnClickListener(this);
  25.  
  26.  
  27.  
  28. }
  29.  
  30. @Override
  31. public void onClick(View v) {
  32.  
  33. int numero= Color.parseColor(v.getTag().toString());
  34. Dibujar.cambioColor(numero);
  35.  
  36.  
  37.  
  38.  
  39. }
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51. public static void cambioColor(int color){
  52. pincel.setColor(color);
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement