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 ?
Related
For learning purposes, I want to implement an HSV color picker like this:
I know that I'll be using SeekBars, but how can I show those gradients in the bar of the SeekBar.
How do I show the 7 color spectrum in the bar, like the first one shown in the image?
How do I show the linear gradient from white to a specific color? And how do I show the linear gradient from black to a specific color?
I am not asking for code, just for rough outline of steps to go about it?
SeekBar indirectly extends ProgressBar, which has a method by the name of setProgressDrawable(Drawable d), to draw that bar as the Drawable you pass into it as its argument.
You will have to implement your own custom ShapeDrawable (probably a RectShape) to give the gradient you want. See the Android Graphics and Drawables guide and classes around Shader, e.g. LinearGradient.
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
i was creating a border using this example:
Is there an easy way to add a border to the top and bottom of an Android View?
I was wonder is there anyway to make the border glow?
I want it to kind of look like this:
https://g1.gstatic.com/android/market/com.feelingtouch.glowsnake/ss-480-4-4
thanks!
Sure, just make a 9-patch and use it as the background.
https://developer.android.com/studio/write/draw9patch.html
I am creating the Android version of an iPhone app, and i need them to look as close as possible.
A problem with this is creating the bars and filling them with a gradient color.
Is there a way to fill a view (probably a layout) with a gradient color, other than using background images?
Thanks in advance.
You can create a shape drawable http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape that is a gradient and set it as the background of your view.
If you want to have the gradient overlaying another image, you could use a layerlist http://developer.android.com/guide/topics/resources/drawable-resource.html#LayerList
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);