[TIMOB-28517] Android: CardView "touchFeedbackColor" property is ignored
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-08-09T10:24:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 10.0.2 |
Components | Android |
Labels | CardView, android, touchfeedback |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2021-08-06T03:21:06.000+0000 |
Updated | 2021-08-09T10:24:11.000+0000 |
Description
*Summary:*
The [Ti.UI.Android.CardView](https://titaniumsdk.com/api/titanium/ui/android/cardview.html) has always ignored the "touchFeedback" and "touchFeedbackColor" properties and would never show a ripple effect. Now that Titanium 10.x.x uses the Java
MaterialCardView
widget, we shouldn't ignore these properties anymore because this native "material" widget shows a ripple effect by default.
*Steps to reproduce:*
Build and run the below on Android.
Tap on the card view in the app.
Notice the ripple effect is gray and not yellow. _(This is the bug.)_
const window = Ti.UI.createWindow();
const cardView = Ti.UI.Android.createCardView({
elevation: 20,
// touchFeedback: false,
touchFeedbackColor: "yellow",
top: "20dp",
left: "20dp",
bottom: "20dp",
right: "20dp",
});
cardView.add(Ti.UI.createLabel({
text: 'Tap Me',
touchEnabled: false,
}));
window.add(cardView);
window.open();
*Note:*
As of Titanium 10.0.0, setting the "touchFeedback" and "touchFeedbackColor" properties causes the following warning message to be logged. We should resolve this issue too.
[INFO] MaterialCardView: Setting a custom background is not supported.
*Work-Around:*
Add a view to the CardView and set it up with touch feedback.
PR (master): https://github.com/appcelerator/titanium_mobile/pull/13000
Merged to master and 10_0_X