Change EditText board colour without shapes - android

I need to change my EditText border colour. I know that there is a way with shapes, setting shape with red boards as EditText's background. But I think that there must be some other and easer way. I searched but didn't found anything. So does anybody knows some other way?

Take one image with border what u like and set that image in edittext background

Related

Android How to change text color according to background image

On Android, I have a header with a background image (Random image according to API).
On this header I have texts with some data. My text is every time black but sometimes image is black too. So, we can't see the text.
I'm looking for library or snippet for resolve this problem.
Thanks.
You can use the palatte library for this. Please see the following:
https://developer.android.com/reference/android/support/v7/graphics/Palette.html
https://developer.android.com/training/material/palette-colors.html
I encoutered this problem months ago and was not really sure how to approach it. First of all you need to use a Layout where you can put View over View for example Relative or Frame. After that you need to make the ImageView thats behind the TextView to be a little bit Lighter or Darker (like a shade) at the place of your TextView so you can choose a color for your text which will always be readable since the shade will be in contrast with the text. What you can do is put something behind the TextView and the ImageView which will be Light or Dark and make the ImageView a little bit transparent using set.alpha(int) if i remember correctly. So at this point you will have transparent image with a light or dark rectangle behind it. It will be visible that the part where you have the rectangle is darker/lighter. Then you put your TextView there with contrast color to the Rectangle and you will always be able to see it. It is kind of complicated, but it will work. Hope it helps.
I think palatte is not available for android. So glide will be a better option. Link

how to make gradient stroke with transparent background android

I want to create an EditText which will have a little transparent white background (about 30%) and gradient as a stroke, but i don't know how can i make gradient as a stroke color.
I try to do something like this:
example
Could you help me in this issue ?
Check this topic, its similiar like yours, you just have to make a custom edittext.
Custom designing EditText
I've already tryed to do this way, but in i can't add gradient only pure color (ex. android:color="#000000").
I know how to make custom rounded EditText with transparent background, and i only want to know how could i use gradient instead of color in stroke ?

How to change GreyScale images to Colored variants?

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"

Android: How to turn Anti-Aliasing off for TextView and Layout

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.

Does changing background color in android destroy the widget's appearance?

I've noticed that changing the background color of an android widget (ex. Button or TextView) by program:
myButton.setBackgroundColor(Color.BLUE);
makes it to loose its 3D shape, border, and shadows effects, and then appears like a ugly flat square. What am I missing?
Sorry for the very naive question but I couldn't get it right although tried for a time.
Rounded corners, shadow effects, etc are often accomplished in Android by using images. See this developer documentation for an explanation of how that works.
A widget can have either an image background, or a solid color background. So, by setting the background color you are override the background image. If you want to change the color without losing everything else, you need to edit the image files.
See:
How to set background color of a View
Is it possible to have a Button with a background image with text on top?
How to gradient fill a button's background?
Problem with EditText background (android)
Since background is a drawable, you can modify the drawable to change the color:
myButton.getBackground().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_ATOP);

Categories

Resources