Android. Gradient Image is displayed incorrectly - android

I have got another mysterious issue. So, I am setting a background image for LinearLayout. This image contains gradient. Don't know why, but after I launch application the image appears to consist of several parts that actually form "smooth transition" of gradient, and that's why it seems that background image is not a gradient.
Could you please advice how to fix this issue?

The emulator and many Android phones use a 16bit color palette. 65536 colors may not be enough to smoothly display your gradient.

Related

Changing drawable Image colors to a specific color?

I am new to tesseract.
The image provided is just an example, the actual image is an Identity Card.
I have a question. I would like to change the background colors to a specific color. Let's say 'black' but the text color remains the same. Is it even possible? I am not sure what exactly I am supposed to be learning in order to achieve it.
The purpose of converting the image color is because when I run my tesseract on my ID, It displays some weird symbols. This is because the ID consists of background designs. Any guides will really be helpful ! Thank you !
UPDATE
Okay, I found this image from google search.
This will be the image that I will be loading into my application under ImageView. Is there any way that I can only keep the black text on the Identity Card and remove every other colors from the image to white, pixel by pixel? Can it be done ?
*Sorry for not providing a proper explanation previously! *
RelativeLayout background;
background = (RelativeLayout) findViewById(R.id.background);
background.setBackgroundColor(
ContextCompat.getColor(MainActivity.this,R.color.black));

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

Android Bitmap - Replace an object's color keeping Anti-Aliasing

I have an image in my assets folder on which I am drawing stuff using an external program and then using them in my app. The problem is that the bitmaps are blank (transparent) with black and white objects in them. Note that the objects are created with Anti-Aliasing on to look better. I know this was asked before but I couldn't find what I want. I need to replace all the black and white pixels in the image (even the transparent anti-aliased ones!) to the colors given by the user. Below are some images to show what I want to do:
Please note that this is just an example and I have even some very complicated shapes and the final colors aren't known (as inputed by the user in RGB style).
Any help is appreciated. Thanks! :)
Usually you can tint the images you load apliying them a color at runtime.
The problem is that color applies to the whole image and it only matchs exactly the same color in white pixels, with or without alpha.
So you could separate all the areas of the image with the same color, save them as white and then tint them at runtime while overlapping one over another.
It depends on the framework you are using.

Android 9-patch image usage

OK, I've read a lot of tutorials and even downloaded some examples, but for the love of Stackoverflow, I can't get my image to stretch like I want it to and I'm hoping that someone can help me out here.
I create an image that is to be the background of a button object in Android. Here is the image:
Now, I'd like for it to stretch to the desire size of the button, whether the button is 50x50dp or 200x100dp. One thing I don't want is the border to stretch as it will look distorted, so I want to specify not to include the border, but stretch everything else to the desired size of the button.
Can someone please show me where the black lines need to go in order to achieve my goal? Do I have to change my original image in order to achieve my goal?
Thank you in advanced.
David
It's very simple using this tool Android Asset Studio: Simple 9-Path Generator. Although no matter how you do it you will have stretching and distortion due to the textured (non-patterned) background. I would stay away from that style both personally and for usability.

Recreating a specific Edit Text Effect in WunderList in Android

I recently downloaded an app from the market called WunderList and it has this neat effect on a Edit Text for transparency
I am trying to recreating the same effect for one of my applications but I am not really getting anywhere. I initially thought it is just transparency but I was wrong. Now I have put an image with shadow as the EditText's BG an trying to set it's alpha. I am not sure If I am on the right path. I would appreciate any guidance on this.
I got this done through a custom 9patch image. Here's a sample result.
It's not close but I am getting closer.
That's actually the way we do it.
We use a 9patch PNG with transparency.

Categories

Resources