Ripple effect not working when clicking inside view elements (Android Appcelerator)

Viewed 605

https://gyazo.com/7ffd965136f18e44aa87c591e3b90ed9

As you can see in the link I provided, when I click on the Label or the ImageView that I have inside my View, the ripple effect does not work. How can I fix this?

I'm having this problem in both 6.1.2GA and 6.2.2GA SDKs

This is my XML file:

<CardView id="selectCard">
    <View layout='horizontal' backgroundColor="#fafafa" touchFeedback="true" touchFeedbackColor="#808080">
        <ImageView class="icons" id="locationIcon" image="/icons/address.png" top="8dp" bottom="8dp" left="16dp" />
        <Label class="titleLabel smallText" text="L('selectInMap')"  />
    </View>
</CardView>

I tried deleting the View inside my CardView and then setting touchFeedback and touchFeedbackColor properties to the CardView, but then I see no ripple effect at all

3 Answers

Set touchEnabled:false on the label and imageview should fix it

Ripple effect is basically used to let users know that this area is touchable/clickable or will perform some actions upon touch/click.

As answered by Rene Pot, this works on any Ti SDK for Android 21+. You can use the same hack even on Ti.UI.TableView by setting touchEnabled : false on all UI elements in order to have Ripple in entire row.

That's the same reason why Android provides Buttons with Ripple Effect all along their dimensions since Buttons are strictly supposed to perform actions on touch/click.

Related