Last active
May 19, 2022 05:05
-
-
Save jchernandez/c4939d5831ff7784bd4736d3e2439da1 to your computer and use it in GitHub Desktop.
Drawable for a touch hover effect pre lollipop and with ripple effect and an example usage
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
<selector xmlns:android="http://schemas.android.com/apk/res/android" | |
android:exitFadeDuration="@android:integer/config_shortAnimTime"> | |
<item android:state_pressed="false"> | |
<color android:color="@android:color/transparent"/> | |
</item> | |
<item android:state_pressed="true"> | |
<!--<color name="touch_hover">#44565656</color> --> | |
<color android:color="@color/touch_hover" /> | |
</item> | |
<item android:drawable="@android:color/transparent" /> | |
</selector> |
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
<!-- res/drawables-v21 --> | |
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |
android:color="@color/touch_hover"> | |
<!--<color name="touch_hover">#44565656</color> --> | |
<item | |
android:id="@android:id/mask" | |
android:drawable="@android:color/white" /> | |
</ripple> |
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"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<android.support.v7.widget.CardView | |
android:layout_width="match_parent" | |
android:padding="8dp" | |
android:layout_margin="8dp" | |
android:layout_height="200dp"> | |
<ImageView | |
android:layout_height="match_parent" | |
android:src="@drawable/example" | |
android:layout_width="match_parent"/> | |
<View | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@drawable/touch_effect"/> | |
</android.support.v7.widget.CardView> | |
</layout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment