Why is setImageResource changing the color - android

I'm working with android and trying to use an image button. Everything works fine, the only problem is that when I display the image on the emulator, the buttons background color is different then the background of the app. I'm on my mac and I'm using Paintbrush to create the image, and the Digital Colorometer to check the RGB values. Everything checks out, the images have the same background RGB as the image, but one run on an emulator, it lowers them from (84,20,109) to (62,0,86). The colorimeter also says "(clipped)" next to the green value. I'm not sure why this is happening and it certainly is annoying as the buttons clearly stand out now. Is this because of the emulator or is something else happening?
Thanks for any help
Also: I have tried both, using setImageResource, and using android:src. Both have the same result shown above.

I figured out what was wrong. It turns out that my emulator was lowering the color values by 20. I resolved it by setting the background color to exactly what it is in the app.

Related

Removing Image Background Android

I am working on an Image editing app, I have done almost everything that is cropping, re-sizing, filters e.t.c but I cannot seem to really figure out how I can remove image background,the basic idea is the image will have a distinct background e.g subject can be grey and background white or vice versa, I tried looking up here and other sites but could not really find anything matching my description the closest thing was to use OpenCV which did not really do the job well, for the most part it was slow (using GrabCut), if anyone has tried this before or knows how to please help thanks in advance.
You can iterate over your bitmap through all pixels. And check if pixel color value is near in color value of your established background color. And change those pixel color values to transparent etc.
Edit: this answer may be useful

Color issues from photoshop to android

I have created some images and set some colors using photoshop and applied them to our app in android studio, but for the same hex code, colors arent same, I do not understand why this is happening. I took a screen shot of the color im working in photoshop and then opened the image in photoshop, surprisingly the color code changed, and it was same as android studio was showing and its not the actual color, I have even checked the RGB/ CMYK mode, it is in RGB mode, i even tried CMYK mode, in the both the cases the problem persists. No matter how many times i have tried, the problem persists. Please help me out
I agree with Rodrigo, you should set a color workflow.
If you are mainly working on documents viewed on the web or mobile devices :
1) in Photoshop go to Edit>Colors Settings and set your RGB Colorspace to "sRGB".
2) Make sure Proof Colors is unchecked in the View menu.
3) Make sure your document has the "sRGB" color profile attributed (can be fixed by using "Attribute color profile" or "Convert color profile" in the Edit menu).
This should ensure color consistency across most devices and web browsers.
It very strongly depends on device screen. I have 4 devices, and colors are different on all of them
You have to setup your color profile in photoshop, by default photoshop gives you different colors when you save for web. Check out this tutorial step by step and let me know if this fixed your problem.
http://viget.com/inspire/the-mysterious-save-for-web-color-shift

Samsung S3 colors issue

We are experiencing a color change only in S3.
The color is well defined as Hex in the layout XML.
on all devices it is green, but on S3 it some times turns red
Edit due to the negative responses:
Just to be clear, the color was changing on S3 only sometimes, and in run time.
apparently calling set background to a previusly set view caused this to other views in other activities that had the original color set for them as well
Try to set the color in a different way:
YourView.setBackgroundColor(Color.argb(255, 255, 255, 255));
And so not from the xml-files.
dude, I think its not related with your coding or Hex value, check display settings for S3. Go to settings and then select display and then select screen mode and finally choose Natural option from it. Hope it works. You may try other variations from it.
Apparently On S3 (at least) if you set in the layout a views background, and then change it programmatically to a different color, the original color will show as the new color throughout your app.
Jitesh Dalsaniya & Salman Khan, you can try and recreate what i have described.
Hope this post will help anyone that runs into this weird issue.

Transparent image with shadow on android screen

I created a transparent image using gimp, and used it as Android apk icon. But when I installed the apk on my Galaxy S3, there is a shadow when display the icon on my screen. Since I can't post image as a new user, I posted the image at:
http://www.guangnaqu.com/P1030055.JPG
Please noticed that other apks' icons are ok. Also the icon displayed ok on Android emulator.
Please let me know how to fix this.
Thanks.
It might be TouchWiz causing the problem.
I had a similar issue in a previous form of TouchWiz where it would make an entirely new color background of its choosing.
1.Edit it with GIMP http://www.gimp.org/ for an invisible background. just throwing out options JIC it is the image editor
2.Try to give the background something like a 0.05% Shader background setting that cannot be distinguished by the phone screen, but is seen by the UI.

Android background graphics and color getting change with change in device type

While using an image(plain fill color image) as background to say any view . The screen color changes by varying the devices and emulator.
I know that if we use images they should not be explicitly stretched in GUI design. I have used wrap_content only no GUI layout variations.
Also when I use color(#ebebeb) in place of image , still the problem persists.
On Running the view on Samsung-Gtab it shows color as "#efebef" and on emulator it shows as "#e8e8e8".
Please suggest , I am still facing this problem though I have pre-requisite knowledge about the device densities.
How to have the exact same GUI contrast for the app on different android platform...???

Categories

Resources