Last active
February 5, 2021 14:58
-
-
Save joesteele/cb86986a5c56d1db5c9f to your computer and use it in GitHub Desktop.
Ripple when view has alpha background
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"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="rectangle"> | |
<solid android:color="#66000000"/> | |
<corners android:radius="4dp"/> | |
</shape> |
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"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="rectangle"> | |
<solid android:color="@android:color/black"/> | |
<corners android:radius="4dp"/> | |
</shape> |
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"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="rectangle"> | |
<solid android:color="#316C41"/> | |
<corners android:radius="4dp"/> | |
</shape> |
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"?> | |
<!-- Ripple effect does not work, but the drawable background does --> | |
<!-- http://d.pr/i/1fQTf --> | |
<ripple android:color="#1A000000" xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:drawable="@drawable/btn_alpha_bg" /> | |
</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"?> | |
<!-- Ripple effect works, but the drawable background is gone --> | |
<!-- http://d.pr/i/15hka --> | |
<ripple android:color="#1A000000" xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:id="@android:id/mask" android:drawable="@drawable/btn_alpha_bg" /> | |
</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"?> | |
<!-- Ripple effect does work as well the drawable background --> | |
<!-- http://d.pr/i/1lEb9 --> | |
<ripple android:color="#1A000000" xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:drawable="@drawable/btn_normal_bg" /> | |
</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"?> | |
<!-- WORKING SOLUTION --> | |
<!-- Ripple effect does work as well as the alpha drawable background --> | |
<ripple android:color="#1A000000"> | |
<item android:id="@android:id/mask" android:drawable="@drawable/btn_mask"/> | |
<item android:drawable="@drawable/btn_alpha_bg" /> | |
</ripple> |
Updated with working solution.
Thank you! This was killing me
🙏 big thanks. this was driving me mad
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Linked GIFs:
Alpha masked: http://d.pr/i/15hka
Alpha: http://d.pr/i/1fQTf
Normal: http://d.pr/i/1lEb9