Skip to content

Instantly share code, notes, and snippets.

@talhahasanzia
Created December 23, 2016 10:28
Show Gist options
  • Save talhahasanzia/c5b9308fdc5f8637c6d2c56e0c458dc7 to your computer and use it in GitHub Desktop.
Save talhahasanzia/c5b9308fdc5f8637c6d2c56e0c458dc7 to your computer and use it in GitHub Desktop.
Adding elevation on button press.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true" android:state_pressed="true">
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:propertyName="translationZ"
android:valueTo="8dp"
android:valueType="floatType"
/>
</item>
<item>
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:propertyName="translationZ"
android:valueTo="0dp"
android:valueType="floatType"
/>
</item>
</selector>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment