Border-left,Border-right etc for android? - 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.

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.

Android: 9-patch image vs Shape vs Multi icon

Some people from our company create some rule about UI design for Web, Android and iOS. They give us a bunch of icon for each platform. But when i look at Android platform icon, they using multi icon to create 1 icon. For example, button background, they use these 3 icon, 1 for left side, 1 for right size and 1 stretchable for middle.
I think this is how web normally design button background. But i don't think i should do the same for Android (Maybe iOS also don't do it this way but since i only work with iOS for a short time, i not really sure). Normally i would use a Shape or 9-patch drawable for this kind of background. So here i have 2 question:
Which 1 should i use for button background in this example. A shape? A 9-patch drawable? Or multiple icon like this? And which one is worst to use?
If i must have to use multiple icon like this, how to put multiple icon like them into single background?
If their way of doing thing here is incorrect, i need some good reason to talk to them and make them change their mind. So any1 please help me clear about this problem.
Thank you!
9-patch should be the first choice and then is shape. Don't use 3 icon.
9-patch is more easy to use and easy to change if the further design changes. When using shape, you need to define the corresponding XML. If in next version, the background color changes, you need to modify the XML, but with 9-patch you just need to replace the resource file.
The other benefit is that, 9-patch can be created in UI side, programmer's don't have to re-manipulate it if the resource is correctly created. But with shape, programmer needs to know the RGB color, and need to code the XML.
3 icon is not suitable here. First, you have other better options. Second, 3 icon means you need to create 3 views for each of them. Third, the button should have different effect when user click it, with other two options you can simply define selectors, but with 3 icon, there's no elegant solution.

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

Android: Border as gradient

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.

Shape glass effect

I've created a custom toolbar using a gradient inside a shape. It looks very nice, but since we only have the option for 3 colors (startColor, centerColor, endColor) it looks very round. I would like to do a glass effect, which requires a sharp change in color in the middle. Basically I need 4 colors (startColor, justabovecenterColor, justbelowcenterColor, endColor). Now I could have two shapes sitting on top of each other to get this effect, but I don't want to do this. I'm getting into some tricky UI customization here and that would be very difficult to manage on different sized screens.
Does anyone know how I can create a glass effect?
Have you considered using a NinePatch ? This would be a quick and easy way to make a good looking, scalable set of shapes...

Categories

Resources