Android: Custom Tab Icon Size - android

Ok, I am going to building some custom tab icon images as explained in the following post. But I just need to know what size do I need to build my tab icons? I keep on guessing and then putting them in this demo and they get squashed or changed. What ratio in pixels do I need to create my tab icons so that they appear right?
SOLUTION:
I will give sandy the best answer, especially since he is the only answer at this point, and because I did eventually use a 9 patch image. But I tell you what, for someone who is new to the graphic editing game, 9 patch images were a pain in the butt to use. I eventually just download someone else 9 patch image then edited the image for what I needed. If you look at my other question here. You can see the image I use as the background behind example 1 and example 2 are 9 patch images. And that works great because everything looks perfect when you move it to landscape mode as well.

You need to create a 9 - patch image.. for more see here

Related

Shadow on 9 patch

I have original of this in SVG form
https://drive.google.com/file/d/0BzqAeDSZdzF4WE9vRVZnTVZSRzQ/view?usp=sharing
Second SVG
9 patchs left
9 patch right
I rarely ask questions here. But, maybe someone happens to know a quick fix for this. Should I remake the image or shadow? I rather not to trial and error if it's possible to find an answer. on the right there is a perfect shadow effect like wanted.On the other hand, on left I have this dark grey which doesn't produce a relaible shadow effect. I checked few answers here and did not see any solution. I also don't understand why the right side is good and left side is bad. Maybe it is with the 9 patch quality?
I tried the RGB 8888 and other suggestions from SO and they did not resolve this issue.
P.S.
tried this Fully transparent activity with 9 patch corner image and it didn't help either.
Here's the ugliest example i could create on my computer:
it works well, as expected.
You can try uploading it to the Simple nine-patch generator to play with its stretching and contents to see how it behaves.
I have uploaded the demo project after implementing the same with 9 patch images provided by you. It looks fine. DO let me know if I am missing or update the same project with the problem. Demo with 9 patch

Understanding the function of this particular 9 patch image

please check out this link:
This is a tool to generate 9 patch images for splash screen in ionic framework, now from my understanding of 9 patch image , if there is a black line , it means that the image is allowed to stretch in that region.
However in the tool dots are mentioned.
Can you please help me understand what that means. My splash screen used to be a single png file with a logo at the center but was a bit distorted, Now after I have implemented 9 patched images, the distortion has gone but the logo has become quite small.
Any idea why this is happening ?

9 patch isn't working on device

I'm trying to make a 9 patch image to be a header of my application but it doesn't work.
This is the image:
As you can already imagine, I want only the middle (blank) part to be streched and nothing else. It works normally in eclipse screen preview but it stretches it as if it wasn't 9 patch when i run it on my device.
I've had problems like this before so I'm clearly doing something wrong with 9 patches, I looked up a lot of info and tutorials on 9 patches and I just don't seem to get it. Could someone give me a good explanation where exactly to put the black dots for it to work and why?
When you put those extra lines in an image, they work like this:
Top and Left extra lines define the vertical and horizontal pixels which will be stretchable (the intersection is called stretchable area).
Bottom and Right extra lines are optional and define the padding. In this case, the intersection is the region in which the content will be placed (the rest is the padding).
I recommend you to use the 9 Patch editor included with the Android sdk. It is called draw9patch and can be found at <android-sdk-root>/tools. You will be able to see a preview of your image with 9patch.
Links:
Draw 9-patch
NinePatch
2D Graphics - Nine Patch
I can't believe it, the next thing I tried after asking a question worked. The fact that I had TWO lines in the bottom was the problem. I just put a single line BETWEEN the images in the bottom and it worked.
Like this:
If anyone still gives me a good explanation for each of the four sides of the image (why and where should the dots be put), I will still accept that answer.

Image with Centered Text (part of the image) in 9 patch?

I am trying to create a 9patch png for a button in Android using an image with some static text and an icon in it. I used the 9 patch tool in the sdk but when I try to use the resulting png, I get malformed 9patch errors. Here is an image of what it looks like in the 9 patch editor...
Is this scenario possible or(is it because I have too many patches) or is my issue something else?
Basically what I discovered is that although possible, there are better solutions (the one mentioned above and described in more detail below)
I ended up going with the solution mentioned in the comment above. Creating a nine patch of the background/gradient and then floating the icon on the left and putting text as a property of the button itself. Works well enough!
As noted below by the commenter, this actually is possible as long as you don't have broken lines on the right or bottom of the 9patch... So If you took my above image and just removed the two lines on the bottom right side and the right bottom, it works like a charm (I'm still going to go with the other option however)

Using non simmetrical button background images

Id like to have a button shaped like a cloud. A 9 patch might be unusable since every time I create large borders around my cloud image, I get warnings about "bad patches" in the 9 patch tool. Using 1px borders gives weird results too 1. When replacing my resource with the btn_default from api 4 I get expected results, ruling out xml issues.
Without using 9 patches, wrap_content seems to work no more, growing the image to 100% width regardless of content. The 9 patch used is shown below.
I wouldn't mind some distortion, as long as content does not overflow. What would be the best solution?
I am not allowed to post images yet, apparently. Please see
zip containing screenshots and 9patch
Nice question.
I think there is no way to use those images and you might need to change them, but I will leave you some tips or things I would try:
To avoid overflow you will need to define the fill area. You can try just adding a fill area but not a scale area. If this works, you will have the cloud image with the text inside it.
Remember that 9patches scale up and not down.
Here is a link with a very good explanation of how everything works.
If nothing worked so far I would ask the designer to create a new image resource with a stretchable area. For instance, having cloud shape just in the corners.

Categories

Resources