Created
July 9, 2019 08:45
-
-
Save erdemtopak/e966e94dbd7d859469788fc9fd7e1e3d to your computer and use it in GitHub Desktop.
Drawable Transition animation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
** res/drawable/transition_background.xml ** | |
<transition xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:drawable="@drawable/shape_selection_label_background_gray" /> | |
<item android:drawable="@drawable/shape_selection_label_background_blue" /> | |
</transition> | |
** layout file ** | |
<TextView | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:background="@drawable/transition_background"/> | |
*/ | |
// Usage | |
val transition = textView.background as Transition | |
transition.startTransition(300) | |
transition.reverseTransition(300) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment