I want to make in my application some meme - type images.
I've found some fonts, which I can use, but one thing, which is connecting them is, that when I'm changing textColor property for TextView, which is contining text, I'm changing contour of letters, not whole letter color. When I'm changing background color, I'm changing whole TextView field background (and I want it to be transparent). And the problem is, that in letter I can see background image of photo, which is under the letter, which is problem, because photos can have different colors and text could be not visible. Is there any possibility, to change background color, but only for letters? Or it is a job for someone who is working with graphics and fonts?
There is a photo, which is from my app, which is showing problem.
And there, what I'm looking for:
(source: canada.com)
It sounds like what you want is text outline or a text shadow. This question has both of those already answered. Or you could instead use solid font types.
It sounds like you want to change the text colour not the background colour.
The thing is fonts are all defined like small bitmaps, if you change the colour only the opaque bits will be colourised never the bit's which were left transparent.
I think your only option is to change font
Related
I have an ImageView and a TextView. They both use ?attr/somecolor to see what color they have to use depending on what theme is selected. This somecolor is either black or white depending on theme.
Now when I say they both need to be red using R.color.red, the TextView has a more brighter red then the ImageView.
sometext.setTextColor(ContextCompat.getColor(this,R.color.green))
someimage.setColorFilter(ContextCompat.getColor(this, R.color.green))
Is there any reason why these colors don't match up?
For what it's worth, here's what I get for an ImageView with app:tint="#color/black and a TextView with android:textColor="#colorBlack, and then
someText.setTextColor(Color.RED)
someImage.setColorFilter(Color.RED)
It's hard to say exactly what you need to do, but there are two different things going on here. For the TextView, you're literally just telling it what colour to draw with. That should always come out looking how you expect.
But for images, it's a little more complicated. You're applying a tint over existing image data, which interacts with the original colours and alpha to produce a final mixed image. For a bitmap image, that colour is in the individual pixels. For a vector drawable, it's in attributes like the fillColor.
For example, that fill colour on the arrow is #color/white, but here's what happens if I knock the alpha down by setting android:fillColor="#AAFFFFFF":
You can see the colour is different - it's actually partially transparent so it's blending with the white background. Applying full-alpha red over it didn't change the overall alpha - and it can't really, it's the alpha that says which parts of that square image are "empty" and which are "the arrow". (Well, you can do that with a different PorterDuff mode, but by default it doesn't!)
The alpha of your tint matters too - here's a partially transparent tint applied to the #color/white arrow (and the text):
someText.setTextColor(Color.parseColor("#99FF0000"))
someImage.setColorFilter(Color.parseColor("#99FF0000"))
And here's the same tint applied when the arrow's fill colour is #color/black
So the colour tint, when it's partially transparent, only really shifts the overall colour appearance, rather than fully replacing it. So check your R.color.green value and make sure it's actually fully opaque. If it's not, and that's how you want it, then pay attention to the fillColor you're using - you can see there that I'm applying the exact same colour to the text, but it matches more closely when the arrow is white
The other thing is the different PorterDuff tinting modes you can apply with setColorFilter - I can't really go into them right now (some info here and here) but you can control how the tint colour and the image are composited, how they're blended together.
Ideally you'd just make your image's fillColor white and apply your tint to it and call it a day, but if you can't do that (because it's in use elsewhere) or you need to tint bitmaps, you can look into that stuff!
Instead of using the ?astr which is for the main portion of the app user interface example navbar and things like that. You can create your color as Third Primary Color and just call it from there. I only use the ?astr for main color of the title bar or nav bar.
When you define the color as a third primary define the same color in both themes. You should get the same color for both. I do this a lot on all of my apps.
Also Android Studio is yelling at me saying that the ?astr is no longer needed. So I have a feeling that it will be done away with in the future.
Also defining your own colors will ensure the colors are the same. Be sure to set the same #13345fg(not actual color) with both themes that are pre-built for the app.
I know how to use a font.ttf as a type face in my app. However when I use a font that has a bubbly look ( hallow areas) then the inside of the font takes the background color
For example, my background color is green and the font color is red then letter O is filled with green color. I would like it to be white? How can I achieve that. Do fonts support "fill color"? Games like clash of clans and any other games have always fonts that have filled color different from background color ( unless an image is used instead of the text).
Any idea?
I'm working on a little side-project that uses images with only grey-hues and no colors. I was wondering if it's possible to throw something like an opaque (is that the right word?) 'filter' or 'layer' over these images to color them according to the strenght of the Grey color.
Say I want the images to be blue, do I get the pixel-data and up the 'B', or is there an easyer way?
Basically what it boils down to is this: Everytime the app starts, a different color is selected (Orange, Blue, Green, Pink, etc.) and thrown over the grey images. But how does one achieve this?
-Zubaja
As #DerGolem mentioned above, if you want to do it programmatically, it looks like one of these tutorials could help you solve your problem:
Example to apply ColorFilter on ImageView
Swap color using ColorFilter
However, there might be an easier way. I haven't tried this myself, but this is what I would do:
In Gimp, or some other photo editor, convert the grey in your images to alpha (transparent). Then put your image in an ImageView in a FrameLayout. At runtime you can programmatically set the background color of the FrameLayout. Whatever color you set should show through the transparent areas of your image, making it look as if you changed the image color.
You'll have to apply it pixel by pixel.Pretty much like you already mentioned.Look here for inspiration:
Image Editing Filters Tutorials
Scroll down to "Android: Image Processing"
When I draw text in TextView or fill background color in LinearLayout,
I found something weird which cannot be found in Windows programming.
The background color in the Layout and text color in TextView,
are not a single color, but a mixed color
when I capture the phone screen and see and check the pixel value on the PC.
If I set the text color or as 0xFF1010FF (Blue),
most of the pixels are 0xFF1010FF,
a few of them are 0xFF1010FD or 0xFF1010FE, a slight different color value,
I guess it is for anti-aliasing.
So does Layout Background Color. (1 or 2 value difference for each pixel)
These effect the color looks smoother in android than PC,
but I don't want to fill color like that, but just with exact color value.
Can I make the color with an exact single value?
I tried TextPaint.getPaint().setAntiAlias(false); but it didn't work.
Moreover, I may not be able to use TextPaint for the Layout Background.
This question will be a common issue for most android developers,
so I will be very appreciated for any of your advice.
Thank you.
I tried this, and it worked for me :
TextView textView1 = (TextView) findViewById(R.id.textView1);
textView1.getPaint().setAntiAlias(false);
This effectively disables antialising, so IMO it's not to be done, but if it's what you're looking for, there you go.
In my app, I have a webview that contains images and text.
I'd like the image (that is latex codecogs style, example: example of latex codecogs image ) to have a white font (If not, I can't really see the equation), and the text to have an other font (transparent).
My problem is that the image latex is really hard to see if I have a color font, but I need a color font for the other parts.
Is it possible?
Thank for your help
You cant change the font of the text in an image... in fact you cant alter the image like you wish as an android option... I would advise you change the font color in photoshop or something similar using a replace color function. you CAN, however, set background color and text color seperately for different pieces of text.