Android: Border as gradient - android

How can I create a border (gradient from #color1 to transparent) around the activity using XML styles? Please see the image below.

With plain XML this is not possible (as far as I know). But you can use the 9-patch images in order to do this. Just create one with the Draw-9-patch tool from the sdk.

You can do it with and tags as special drawables.
Take a look at this example.

Related

Custom shaped Buttons

I have zero knowledge of custom shape designing in drawable.
I need to design custom shape button where the text on the button will be displayed from server.
Can anybody please help me in designing this shape?
Also, the shape should be auto adjustable like the button is used to function in wrap_content.
I need a shape like this:
What you're looking for is the Shape Drawable. Basically, in Android the easiest way to create custom shapes is by creating a Shape drawable and defining its shape in the drawable's XML.
Drawables are better than other image forms such as .PNG - specially for your use case. If you're new to custom shapes and drawables, I'd recommend you to read up more on them and their advantages.
Also, take a look at this question for a working example.
You'd find a number of similar examples all over SO and other websites. You might just also find a shape drawable that matches the exact pattern that you're looking for.

Creating non-traditional shape tooltip in android with border

Hello fellow Android designers,
I am struggling right now to create xml tooltip that would look like the one on this picture:
Unfortunately it seems like a hell of a work. Till now I was only able to create a simple rounded rectangle like that:
Is it actually possible to create such a shape I have presented on the first photo using xml styling or should I try to create it programatically (which will probably take huge amount of time and creating border would be really hard)? Or maybe the simplest solution is the best and I should use partially transparent png image with the shape of my choosing?
Any advice would be much appreciated.
You can draw it using stretchable 9-patch drawable.
You can specify there which parts are fixed (the little knob on the left and corners) and which are stretchable (all other parts)

Border-left,Border-right etc for android?

I want to style a button in my android app, and I would like to have different colors for each border-side/"stroke-side".. is this possible, or would I need to create a 9patch for this..there aint anything equal to border-left and such as in css?
Thanks in advance!
I tried it before and I couldn't achieve it without using the NinePatchDrawable. I even tried using Shape Drawable but you can't apply different colors for different stroke sides.
You can follow these steps to generate a 9-patch drawable.

drawing non rectangular shapes on android

I am try to implement this shape with android xml drawables:
I am able to get the rectangle but I can figure out to get the triangle tip. I also need to apply a gradient to this shape.
Any help is greatly appreciated.
I think leveraging XML drawables is to create a clipping-mask via 9-patch drawable and then project that onto a rectangle drawable.
This probably will require a custom drawable class though. I searched and found that this Q/A might solve that part of the problem. Masking a Drawable/Bitmap on Android
Looking at the SDK docs ClipDrawable implies that it would help with that but it turns out that it might be a poorly named class. It doesn't do what I thought it would.
The easier way to accomplish this is to just create a 9-patch out of the object itself. You lose the gradient flexibility unfortunately when you do this.
You can use 9-patch to draw it.
http://developer.android.com/tools/help/draw9patch.html
just crop a little path around with triangle tips and make 9-patch like this check this link and then use drawable shape to draw your gradient on top of it.

How to achieve glossy look in android

One of the applications in my mobile has this glossy and transparent look(refer the snapshot below), which is quite beautiful. Just want to know how I can achieve this.
I am developing an application for myself and want to implement similar kind of GUI. Although I can create a layout, I am still not good in creating beautiful icons like the one shown above. Any information (or) a link to icon development related tutorials should also be quite helpful. Thanks everyone in advance.
Those are just PNG images with transparency and glossy effect... it almost has nothing to do with programming. Just find a good designer and tell him/her to do a 9patch image like that.
By the way... background buttons, in that case should have the border only. The icon and text can be then added easily.
You have to combine multiple techniques. You can use Button where the background will be defined with a nine-patch image, with rounded corners. Then you can use android:drawableLeft parameter of the Button, to define the icon it will have.
As also Cristian suggests, this is not hard to implement. You need a good designer and get to know the basic techniques like 9patch png images, transparency and basic layout definitions. Good luck

Categories

Resources