Svg Buttons Vs Nine Patch Buttons - android

Has anybody experience with using svg for creating custom buttons on android? I recently stumbled upon the svg-android project that was used for androidify and I'm wondering whether it is worth the trouble rewriting the code.
At the moment I'm using nine-patch buttons. The only problem is that I need to create several images for different resolutions. However, if I switch to vector graphics, I'm not sure how to preserve the rounded corner radius when I resize the button, for example.
Has anyone experience and can tell me whether it's worth the trouble ?

It sounds like you should maybe use Shapes instead of 9-patches. They superior in most of the cases (especially with rounded corners, gradients ...) : http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
You can also use layer-lists to stack shapes.

The last time I used the svg-android project, it wasn't sufficient for my SVG's due to limitations in its rendering. I don't know what its current state (if different) is, but based on my year-old experience with this on Android, I'd say spend some time to experiment with it before you commit to using it -- perhaps its limitations will not affect you.

Related

Android: Rendering views (text and image) in a rich banner creating app?

I am working on a banner creating app where the user can create custom banners for any purpose. The banner will have text, icons, background, etc. The app needs to provide features such as
Text Editing which includes simple effects like bold, italics, underline, font changes etc. But also more advanced effects
such as envelope distortion, curving, outline etc. Moreover in the
future, there may be more such effects that may need to be added.
Background editing by adding an existing image or creating a background with available options in the app
Think of it as slides in power point where user can add their own text and format it plus have backgrounds. There need to be a lot of customization
I need to decide what tools to use to develop this. The main issue is how to render texts dynamically. The options I have been thinking of are
Using TextViews/EditTexts and other top-level view classes
Using CustomViews i.e Canvas
Using a more advanced and lower-level approach such as an
ImageProcessing library to render text or even something along the
lines of 3D graphic rendering.
I need to make a choice that isn't incompatible to support future effects that may be needed. I am pretty sure TextViews/EditTexts etc won't be the solution here. I am not sure how powerful the Canvas class is and whether it is possible to create such an app by just using CustomViews.
Coming to ImageProcessing or 3D graphics, it may be used to have much more control over the effects by using PixelShading/Transformations etc but it comes with its drawbacks. i.e low level of abstraction and higher development time possibly.
Can some more experienced folks give some insights? Thanks!
Use Image Processing and for different themes use lotte-Animations.

How to handoff animation for Android developers?

I'm a designer and interested in different ways I can handoff animation to Android developers and the best ways to do that depending on a particular case.
1. JSON
I know Lottie works best for animating micro interactions and creating animated illustration, like those on onboarding pages. For a designer it's easy to provide JSON file since it can be generated with Bodymovin plugin in AfterEffects. Developer just gets the file and uses it as is, no more additional efforts for him.
2. Java or Kotlin
UI elements that require complex interaction are usually build with code, like BubblePicker since it has changeable content in those bubbles and different conditions how it can be interacted with. Since design tools don't generate production-ready code designers export video recording from tools like Principle, generate clickable prototypes in ProtoPie or other tools. Designers try different ways to show the idea of animation but in this case all the work is left for a developer.
3. XML
Don't know when developers use this type and if designers can provide it using export from some design tools.
What are other technologies developers use to create animations?
What type of files, prototypes designers should provide for the developer considering different cases?
Android animation API is really diverse, meaning there are lots of ways a developer may choose to deliver an animation. I dare to say this should never be conditioned by the nature or limitations of the provided resources. Let's understand by resources anything that's not actual code: bitmap images, audio files, and even text. Knowing the file types or formats the developer can or wants to use involves communication and you can expect them not to be always the same.
Always provide a video of the animation, unless it can be described with a single word.
The most common animations in android are:
Drawable animations. This type of animation usually happens inside a pre-defined area on the screen and is achieved by loading a series of images, one after the other. Here a common filetype would be PNG images, one for each step of the animation. Probably the same amount of different sprites you used for the video, never as many as 24/s! Keep in mind that to support different screen sizes and densities, different size/densities will have to be provided for each series. If the image is simple Vector Graphics would simplify the job for both the coder and the designer, regular SVGs are supported.
One can also animate on the paths of the vector images, even morph between several of these, as long as the paths are compatible for morphing, which according to the documentation they must have the same number of commands and the same number of parameters for each command....this takes more understanding of the intrinsics of the vector file definitions, if you can see the image by reading the SVG code, go for it!
Another major group comprises the animation (by acting on properties like color, position, size, etx) of the application UI elements. This type may or may not involve image resources, and are usually applied to components of pre-defined types. E.g.: all buttons should have a ripple effect starting where the pointer clicks. Android has pre-defined effects with particular names (flip, zoom), it could be useful to know this vocabulary.
Finally, layout changes are animations that happen when you reorder things around to better convey information or hint the user towards actions. Similar to these are the Transitions, which happen when switching screens but can also be used to create animations that move images around, altering their positions and properties. They are really simple to implement and may require resource files of the same type as mentioned in 1
For reference, check the following which has some code but also illustrative examples:
https://developer.android.com/training/animation/overview
To know how to support different screen sizes, check:
https://developer.android.com/training/multiscreen/screensizes
To know more regarding SVG support in the Android platform: https://developer.android.com/studio/write/vector-asset-studio

Android visual animation on screen touch

I am coding a game in android and i want to play a kind of animation when user touch the screen. I know that there is probably tutorials to do this. But i don't really know what is the name of this effect so i don't know what to search.So all my searches were vain.The effect is like the one you could see in this image(image ) in Magic Tiles 3.
Thank you.
I would suggest you to switch to unity :) Native Android is not really made for that kind of stuff.. More constructive answer:
Quick googling showed couple of particle libraries, for example check this
Running particle like animations natively is not really a recommended way to go since since you will be running around 10-15 animations in a loop (which will have a really hard impact on your apps performance). If you still want to go this way, it would be the best to create animated drawable or use lottie animated image views and set as your layout background

Where do people make their backgrounds?

I am building an application and currently am in the process of add backgrounds in. The way I make the backgrounds are by designing it in Microsoft Word and then pasting it into Paint then saving it as a .png file. This way works but it does not give a clear and crisp picture on phones. I'm wanting to know what do you guys use when putting backgrounds in on your applications. (ie. Photoshop)
Yes Photoshop is better option, but now a days you can make them online if you are not familiar with Photoshop, easily.
Check the following...
wallcreater
bg patterns
x3studios
click this to googled results
Photoshop or GIMP would be my first suggestions

Better version of draw9patch

I've been using draw9patch on android a bit lately and am getting frustrated about how bad of a program it is. I generally takes me 5 mintues per image to add the patches which seems excessive. Worse is that when I have multiple states for an image I have to do the exact same patches on 3 images or they look wrong, I would rather be able to just copy patches between images. I've tried using gimp to do the same thing but find it more difficult.
Has anyone found a better program to create 9 pngs or created their own?
What exactly are you doing? It shouldn't take more than 4 or 5 clicks to add patches. You're just adding single black pixels or lines of pixels on the outer frame.
Personally, I use Photoshop to do mine, but if you don't already have it, it's an expensive investment. GIMP or Paint.NET can easily do the same (technically, even MS Paint, but I wouldn't wish that program on anyone), and they're free.
EDIT: Somehow overlooked that you've already tried GIMP. Any new software is going to have some learning curve, especially if it contains more functionality. draw9patch is pretty much the bare minimum of functionality, so it's simple to use, but trust me when I say it would be worth your while to just improve your skills in GIMP or Paint.NET instead.
EDIT: Okay, just wanted to say I judged too quickly here. I've really only used the draw9patch tool for minor modifications, and testing my NinePatches I made in Photoshop. The process of drawing a line in d9p is an absolute pain in the ass. I see in your comment you said you've tried Photoshop. What you can actually do to make it easier is add guides (View > New Guide) at the pixel locations you want, then just use the pencil tool at a 1px brush size, click and hold at the start of the line, hold shift and then drag to the end of the line. Photoshop has an annoying bug, however (at least in my installation of CS2) of selecting the wrong pixel when zoomed in very close, so you may have to end up erasing a few stray pixels that end up past the guides. I would do your black border as a separate layer as well, to make things easier.
GIMP does not have a Line Tool, however if you pick the Pencil tool, then you can press Shift to make lines (well done GIMP, everyone should have been able to guess to press Shift, right?).
{complete tutorial}
This is an older post, but there is a tool out now called Better 9 Patch Tool that makes drawing these a breeze. The whole thing is written in Java so it runs on pretty much everything and is Shareware, so you can try it before you buy it. And if you're unhappy with doing this in Photoshop or the draw9patch tool (as I was) this is a pretty good alternative.
Link is here:
http://www.roundrect.kr/desktop/better-9-patch/

Categories

Resources