what is the use of shadow - android

What is the use of shadow in Android?
How do I implement shadow in thumbnails?
If someone has a sample screenshot, do you mind sharing it?

Shadows can be added to TextViews through XML or programmatically.
If you'r wanting to add a shadow to a standard view (or any subclasses) this thread should point you in the right direction.

Not knowing what are your objects could be tricky. you can define what's the background in the picture and filter it, then you can strech your image in the direction of the shadow. now filter everything but the background, so you've got 3 layers - background, shadows and objects. place the shadows on the background and on top of that the objects.

Related

How can I achieve curly or wavy borders for a view on Android?

There is the concept of rounded corners for views and drawables in Android, however, am working on an interface for a kids robot, and someone asked for curly borders - sort of like wavy (sine wave kind of thing). Now, how the heck can one achieve such a thing in either XML or Java - especially, without resorting to use of image overlays or backgrounds?
rounded corners aren't in fact rounded Views, its just a bit of transparency in corners. you can create some custom drawables/Bitmaps and set for your Views (as a background or use ImageView) or you can use custom programmatic drawing like HERE
Have tried to use images of that form and use them as background in a transparent container?

How to create round shape image using android?

I am having four piece of image.
Here I attached one sample image.
How can I create the round shaped image using these type of images?
Which layout is best for creating the UI for android?
Thanks in advance.
are you talking about something like this..
http://www.baijs.nl/tinycircleslider/
And for designing the UI for Android is depends on our requirement.it means whether you want to design something looks like rows and columns then GridLayout and tableLayout will be better,depends on requirement and look the layout will changes once try it your self and choose the best suited for your applicaiton.All the best Mate
inside relative layout add four imageview with attrs ParentTop, ParentRight, ParentBottom and ParentLeft. every image is rectangular with transparent extra area.
i can understand it is little hard to visualize on first attempt.
now come to click area. so a runtime decision about ignore transparent area click will be right thing.
more tricky way will be manage flags for all listeners and if two listener get calls its transparent area .

Draw a gradient filled polygon to use in a selector

I am trying to create a drawable such as this in Android:
I don't think a nine patch will work because there is nowhere that can safety scale vertically. So next I tried a shape drawable but it does not support triangles.
I want to render this image on the fly so there are no artifacts. Also I want to be able to use it in a selector, so I need to be able to represent this image in xml. Maybe I need to extend some class to manually make the shape. If so how do I embed a tag in the xml to tell it where to render? Does anyone know where to start with this or have an example of something similar?
I have read the first 10 pages of hits on stack overflow and google and am not getting anywhere. Thanks very much for any help.
I think a 9-patch would work. For the vertical stretching on the left boundary, fill in the line from top to bottom.

BackgroundColorSpan with additional, vertical padding

In my app I have something similar in appearance to labels in GMail app UI. For those who may not know, they look like this (labels are these colorful bars):
In order to achieve similar effect I use nine-patch drawables - for each label I am creating a TextView and assign drawable to it. This is simple solution, but I don't like it. It's not elegant, it is quite slow as shown by profiler, and I just don't think it's the right way to do it.
I changed the design of the UI to make it more "ICS-y", so I removed rounded corners from the labels. And I started thinking how I could replace 9-patch solution. The most obvious thing is to use BackgroundColorSpan. But it has one, small drawback. I want my labels to have some padding. With drawables, it was easy to achieve. With spans, it's harder. To make horizontal padding, I can just add spaces at the beginning and at the end of the string. But how to make vertical padding larger? To clear things up, this is a screenshot of the label with BackgroundColorSpan:
I want to make the colored parts above and below the text larger. I think I should use some kind of MetricAffectingSpan, but I couldn't figure out which one. Or maybe I should write my own? Or, finally, maybe spans are just not able to fulfill my needs and I should stay with images or create a canvas and "manually" draw everything as in GMail app?
The easiest way to do this, and im pretty sure the GMAIL app is making use of it, are shapes.
Just create a custom shape, in your case a rectangle shape with rounded corners and a solid color, and assign this drawable then to the background property of your textview.
A shape is defined in xml.
You will assign it as follows:
<TextView
...
android:background="#drawable/my_awesome_shape" />

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