Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19912] tintColor for Android ImageView

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2016-04-02T09:56:37.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsAndroid
Labelsandroid, imageview, parity
ReporterMichael Gangolf
AssigneeHans Knöchel
Created2015-11-07T10:51:16.000+0000
Updated2016-06-27T21:06:28.000+0000

Description

Adding tintColor property to Android using ImageView.setColorFilter() Pull Request: https://github.com/appcelerator/titanium_mobile/pull/7877
$.img2.setTintColor("#FF0000");
$.img3.tintColor = "#F0FF0F";
$.index.open();
<Alloy>
	<Window class="container">
		<ImageView id="img1"></ImageView>
		<ImageView id="img2"></ImageView>
		<ImageView id="img3"></ImageView>
	</Window>
</Alloy>
".container" : {
    backgroundColor: "white"
}
"#img1" : {
    image: "/images/img.png",
    top: 0,
    width: 150,
    height: 150
}
"#img2" : {
    image: "/images/img.png",
    width: 150,
    height: 150
}

"#img3" : {
    image: "/images/img.png",
    bottom: 0,
    width: 150,
    height: 150
}

Attachments

FileDateSize
ezgif.com-optimize(1).gif2015-11-07T12:50:15.000+0000285398
tint.png2015-11-07T10:50:50.000+000078623

Comments

  1. Michael Gangolf 2015-11-07

    -https://github.com/appcelerator/titanium_mobile/pull/7410- (old PR) Pull request is "work in progress". I still need to update the documentation but it's working already (see attachment)
  2. Michael Gangolf 2015-11-07

    fixed 'UI Thread' errors. GIF showing setTintColor in touchstart/touchend event
  3. Michael Gangolf 2016-03-23

    new clean pull request: https://github.com/appcelerator/titanium_mobile/pull/7877 Will create a diffrerent PR for Ti.UI.Button.image tintColor
  4. Hans Knöchel 2016-04-02

    PR approved, great work [~michael]! Demo:
       
       var win1 = Titanium.UI.createWindow({
           title:'Tab 1',
           backgroundColor:'#fff'
       });
       
       var img = Ti.UI.createImageView({
           image: "KS_nav_ui.png",
           tintColor: "red",
           top: 20
       });
       
       var img2 = Ti.UI.createImageView({
           image: "KS_nav_ui.png",
           tintColor: "#ff0",
           top: 200
       });
       
       setTimeout(function() {
           img.setTintColor("#ff0");
           img2.setTintColor("red");
       },3000);
       
       win1.add(img);
       win1.add(img2);
       
       win1.open();
       
  5. Lokesh Choudhary 2016-06-27

    Verified the fix. tintColor for ImageView works as expected. Closing. Environment: Appc Studio : 4.7.0.201606150733 Ti SDK : 5.4.0.v20160617074028 Ti CLI : 5.0.9 Alloy : 1.9.0 MAC El Capitan : 10.11.4 Appc NPM : 4.2.7-2 Appc CLI : 5.4.0-18 Node: 4.4.4 Nexus 6 - Android 6.0.1

JSON Source