Last active
September 16, 2017 09:51
-
-
Save rafali/5146795 to your computer and use it in GitHub Desktop.
Background transition on Android
This file contains 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
TransitionDrawable transition = (TransitionDrawable) view.getBackground(); | |
if (toggle) { | |
view.startTransition(1200); | |
} else { | |
view.reverseTransition(1200); | |
} |
This file contains 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
android:background="@drawable/transition_drawable" |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<transition xmlns:android="http://schemas.android.com/apk/res/android" > | |
<!-- The drawables used here can be solid colors, gradients, shapes, images, etc. --> | |
<item android:drawable="@drawable/selector_button"/> | |
<item android:drawable="@drawable/selector_button_off"/> | |
</transition> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment