I have an app, that to chatting. I need to create bubbles. I did it with nine-Patch image but it was not useful because I need little triangle on right (left) of the bubble and when nine-Patch stretches the image the triangle also gets stretched. This is the problem.
Can I Draw background of Layout with canvas or etc. ?
Try this ones
download it and do not forget to rename it with image1.9.png
This may not working give me your mail id i will mail you
Also, check this one and rename it as .9.png
It was created using the draw9patch tool located in sdk\tools folder.
Related
I want a background image to be extendable based on its child.
I am using ImageBackground and Text.
<ImageBackground>
<Text/>
</ImageBackground>
Is there any way to do it?
Here are some screenshots
English version
German version
Use 9-Patch files
In Android Studio, right-click the PNG image you'd like to create a
NinePatch image from, then click Create 9-patch file.
Type a file
name for your NinePatch image, and click OK. Your image will be
created with the .9.png file extension.
Double-click your new
NinePatch file to open it in Android Studio. Your workspace will now
open. The left pane is your drawing area, in which you can edit the
lines for the stretchable patches and content area. The right pane
is the preview area, where you can preview your graphic when
stretched.
Click within the 1-pixel perimeter to draw the lines that define the
stretchable patches and (optional) content area. Right-click (or
hold Shift and click, on Mac) to erase previously drawn lines.
When done, click File > Save to save your changes.
Check this link for the whole article: https://developer.android.com/studio/write/draw9patch
You can use the 9 Patch image for this purpose. Check this for steps on how to create a 9 patch image.
I made simple menu icons which look the way I want them to look when in Illustrator, but when I place them in my app they look pixelated and bad.
Here is it in my app (as you can see, the text is not pixelated):
This is how it looks in Illustrator (I cut the icons and pasted them next to the other two, that's why the background is in different color):
I made the icons on 72x72 px canvas and exported them as .png file.
I am using Android Studio to make my app, and use simple
android:background="#drawable/back_button" to set the image/icon for the ImageButton.
I never try Illustrator to put icons, but I am directly download icons from flaticon that provides any type of file and size too
Two way to get different canvas file in android studio.
Android Studio-> File-> Image Asset or Vector Asset
upload your file and set as you need
Icon Generator
From this you can get directly res folder with different canvas image.
Mostly I prefere first.
Thanks
these icons as shown in fig. have a background color assigned by you in illustrator, no matter these are exported as png format or jpg!
First go back to illustrator and try to make background of images transparent as you assigned greyish color, tell me if it works. That's great you are making icons for yourself. Good work.
I think when you save the file please try to save it (SVG) format & then place it.
I generated 9patch images from Simple 9 patch generator available free on the internet for the splash screen. When I write android:background="#drawable/splash.9", it doesn't recognize the image.
Plus , when I select Android from the drop down menu on left top side , I don't see the images I put in different drawable folders.
No need to add the .9 suffix. It's just there to tell the build environment that this is a 9patch. Link to documentation.
android:background="#drawable/splash"
should be enough
I have just imported a project from eclipse to Android studio. Almost for every second image , android studio is giving the following error.
Error:Must have one-pixel frame that is either transparent or white.
I am trying to edit my images for last few hours, but couldn't do it. Can anyone guide me whats the best solution for it.
Why its in only Android Studio why not in Eclipse.
This is shown because you're trying to edit 9-Patch images that don't have the appropriate 1-pixel border.
Android uses an image format called 9-Patch which allows you to define stretchable areas in an image (you can read more about it here). To fix your problem, either add an outer 1-pixel thick transparent frame to your png images or simply rename them from .9.png files to .png files
I want to create a nine-patch image and use that in my App but I don't know how to create it?
I've searched through the Android source code on the Web and I can't seem to find any examples of this. I need a tutorial so that I can understand the process.
I have searched the best and the simplest answer to make 9-patch image. Now to make the 9 patch image is the easiest task.
From HERE you can make a 9-patch image for all the resolutions - XHDPI,HDPI,MDPI,LDPI in just one click.
Let me know if you have any queries, and do upvote it, if it was helpful to you.
I just found that awesome alternative 9patch editor (by Mikle Garin) and I think it 1000% better than standard one built in sdk:
Editor JAR download link
Editor source code
Editor official page
There's a tool included in the android sdk to create and test nine patch images:
http://developer.android.com/guide/developing/tools/draw9patch.html
You can also create a nine patch file using every gfx package out there ( photoshop, paint.net, ... ) using the creation guideline here: http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch
I've created a tool that allows automatically create 9-patch images from regular PNG images for simple cases where stretchable areas are 1 pixel wide. Here's sample input and output (showed at 400%):
Project page on github
A NinePatch image is a standard PNG image created with Photoshop, Illustrator, Paint... etc.
To add a NinePatch rule to it, just drag/drop it on the draw9patch.bat tool in your Android SDK directory.
IF you don't use the draw9patch.bat tool, you must include an extra 1px transparent border to draw the NinePatch rules with a 1px black (#000000) pencil size before you save it.
Important!!! Save the image with the extension myimage.9.png as a transparent PNG-8/PNG-24.
Image: Explanation of NinePatch graphic rules
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/nine-patches.html
Although android provides the tool for ninepatch images .Open terminal and go to android sdk -tools path and type ./draw9patch. But this is the best link you can make for all density in just one click.