Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

221
Views
¿Hay alguna API que aplique lo mismo en diferentes vistas en Kotlin?

Tengo 3 botones que tienen la misma animación.

llamémoslos, botón1, botón2, botón3.

 button1 .animate() .setDuration(initialTime) .setInterpolator(DecelerateInterpolator()) .alpha(1f) .start() button2 .animate() .setDuration(initialTime) .setInterpolator(DecelerateInterpolator()) .alpha(1f) .start() button3 .animate() .setDuration(initialTime) .setInterpolator(DecelerateInterpolator()) .alpha(1f) .start()

Pero esto es demasiado largo. Necesito algo como...

 with(button1+button2+button3).apply{ this.animate() .setDuration(initialTime) .setInterpolator(DecelerateInterpolator()) .alpha(1f) .start() }

Esto será más claro y más simple. Podría hacer una lista de las vistas, pero este método también es más largo y masivo.

¿Hay alguna característica como esa en Kotlin?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

val buttons = listOf(button1, button2, button3) buttons.forEach { it.animate() .setDuration(initialTime) .setInterpolator(DecelerateInterpolator()) .alpha(1f) .start() }
over 4 years ago · Santiago Trujillo Report

0

función de extensión

 fun Button.setUp() { this.animate() .setDuration(initialTime) .setInterpolator(DecelerateInterpolator()) .alpha(1f) .start() }
 button1.setUp() button2.setUp() button3.setUp()
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!