Skip to content

Instantly share code, notes, and snippets.

@mwshubham
Created October 12, 2017 20:03
Show Gist options
  • Save mwshubham/8e1012e2fdf05b618abd5bba5b72e34c to your computer and use it in GitHub Desktop.
Save mwshubham/8e1012e2fdf05b618abd5bba5b72e34c to your computer and use it in GitHub Desktop.
Android Depressed Button Style
<?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">
<set>
<objectAnimator android:duration="100" android:propertyName="translationZ" android:valueTo="4dp" android:valueType="floatType" />
</set>
</item>
<!-- base state -->
<item android:state_enabled="true">
<set>
<objectAnimator android:duration="100" android:propertyName="translationZ" android:startDelay="100" android:valueTo="0" android:valueType="floatType" />
</set>
</item>
<item>
<set>
<objectAnimator android:duration="0" android:propertyName="translationZ" android:valueTo="0" android:valueType="floatType" />
</set>
</item>
</selector>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment