Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24592] Add backgroundTint in Android Titanium to change the background colors of Ti.UI.Button keeping ripple effect+shadow same.

GitHub Issuen/a
TypeNew Feature
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterPrashant Saini
AssigneeUnknown
Created2017-04-18T04:35:51.000+0000
Updated2018-02-28T19:54:54.000+0000

Description

As you know that by default Titanium Android buttons have their backgroundColor from xml themes keeping the Ripple effect + Shadow intact. But as soon as we set backgroundColor property of Ti.UI.Button in Android-Titanium, the Ripple effect is gone. I really found out the same behaviour in native Android itself & here's the solution. In native Android - we can use backgroundTint property to set any other backgroundColor than specified in theme file. It will keep the ripple effect + shadow same & will provide easiest option to change the backgroundColor of Ti.UI.Button. Hence, we should also have a similar property in Titanium. In attached screenshots, you can see the code & its UI result. Though I cannot capture ripple effect but it's there when you tap button.

Attachments

FileDateSize
Screen Shot 2017-04-17 at 4.06.45 PM.png2017-04-18T04:35:11.000+000019990
Screen Shot 2017-04-17 at 4.06.49 PM.png2017-04-18T04:35:12.000+000071561

Comments

  1. Sharif AbuDarda 2017-04-18

    Thanks for submitting the ticket. Please provide Native docs link here. Our engineers will consider it. Thanks.
  2. Prashant Saini 2017-04-18

    Here's the link: https://developer.android.com/reference/android/view/View.html#attr_android:backgroundTint Native Android Button inherits XML attributes from View as described in above link.

JSON Source