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 ?
Related
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
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.
I have been struggling for a week to run this nine patch image by adding patches to it with all case but it doesn't work , I can't figure out why ? Any suggestions are highly appreciated.
It shouldn't show black lines when I am using it.
This is the layout code where I use this image ,
<Button
android:id="#+id/answerA"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#drawable/d_grey"
android:gravity="center"
android:onClick="AnswerCheck" />
--Edit--
As suggested in an answer I opened this image in ninepatch tool and below is the screenshot for the same,
Possible solutions:
Have you created 9-patch images properly? check out this site
and create 9patch image.
Do not remove .9 extension from image like sample.9.png
Do not resize image after creating 9 patch image.
Refresh-Clean-build project to apply changes you made in resource
folders
Looking at your drawing, my guess is that you have far too many patches, probably around 18 patches instead of the usual 9.
Load the nine-patch into the Draw 9-patch tool (which is in your Android sdk under tools/)
Then select > Show bad patches
Update:
Take a look at this image (taken from this technical blog)
For me at least, that's what I envisioned a 9-patch to be, that there were 9 patches in the png. In your latest drawing however from inside the draw-9-patches tool, I think I'm counting 20 patches
That being said, I'm not sure if what I'm saying is correct. If you have bad 9-patch, the tool should at least be showing you the bad patches surrounded by red lines. And so, it could be that both the blogger and myself are incorrect.
I often encountered this issue also and I usually avoid to put the back line on the very edge of the image.
Try to do it as you did it on the bottom of your image and leave at least 1 pixel on each edge without black otherwise it is not correctly rendered.
I encountered this issue on a xxxhdpi screen. Android doc says for xxxhdpi: "Resources for extra-extra-extra-high-density (xxxhdpi) uses (~640dpi). Use this for the launcher icon only, see note above." In my xxxhdpi device, the 9-patch image was displayed with the black lines borders because of that. When removing the xxxhdpi 9-patch, the display issue was fixed.
I am currently trying to use 9 patch pictures in my app.
The image is quite clear and work pretty well in the graphic tool provided with SDK:
Picture is like this:
and the tool seems to work fine:
Unfortunately, with such a simple layout, the rendering is bad on a device and the 9 patch does not work at all:
<TextView
android:id="#+id/platenumber"
android:background="#drawable/plate_fr"
android:layout_width="320dip"
android:layout_height="wrap_content" />
Any idea on what I am doing wrong?
EDIT:
My picture is named *.9.png
The black lines have to be totally black(RGB:#000000) and the transparent zone around black lines totally transparent.
The extention of your 9-patch image should end with .9.png or it will be taken as a normal image
Check if you have at least one black pixel on all four sides of your images.
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