Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Salva a cor original do botão
- final ColorStateList originalColors = button1.getBackgroundTintList();
- // Define a nova cor do botão
- int newColor = Color.RED; // Defina a nova cor aqui
- button1.setBackgroundTintList(ColorStateList.valueOf(newColor));
- button1.setClickable(false);
- button1.setEnabled(false);
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- // Reverte a cor do botão de volta para a original
- button1.setBackgroundTintList(originalColors);
- button1.setClickable(true);
- button1.setEnabled(true);
- }
- }, 3000); // 3000ms = 3 segundos
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement