I am looking for the best way to develop an Android app that has one component that allows the user to draw shapes, rotate them, scale them, slice them etc. (I am calling this component ActivityArea). In addition to this ActivityArea there need to be regular buttons, textViews, editViews etc. on the app.
I have explored 2 options - using libgdx and building a custom view. Both approaches appear doable. However, with libgdx, as far as I understand, all the buttons, textViews etc will also have to be created using the libgdx libraries. With this regard I have the following questions:
Is my understanding that libgdx will necessarily have to be used to render buttons and other regular android views?
Is there any way of including a libgdx powered view within an android layout?
Are there other libraries/options available that can be used to get geometric functions within an Android app?
Any help is greatly appreciated.
You can use Android UI atop LibGDX if you like. Typically for this you'd use the AndroidApplication.initializeForView(...) method to create the libgdx view and inject it into your layout.
As far as other libraries, if you doing 2d shapes and don't have to have a consistent 60fps, I'd probably just use Android's Canvas.
Related
I'm porting a vector graphics editor from iOS to Android. The app must draw a complex hierarchy of graphical objects in an efficient manner, so that the graphics can be edited with gestures in real time. The edited work commonly consists of images, text and graphical primitives (lines, circles etc.). UI elements like selection highlights are rendered on a separate layer on the top.
On the iOS app, if one component of the graphic changes (for example a small text element changes its content), only that text element is re-rendered.
On iOS, we use CALayer objects from the CoreAnimation framework. This works very well. What framework can be used on Android for this use case? Is there an established "native" way to do that, or are usually third party frameworks used?
Android does not have similar thing out of the box. We do have core.animation but it is limited to simple behavioral animations. To create what you want you need to use SurfaceView or GLSurfaceView and help of clean OpenGL. You may also try to use ordinary Canvas of View - you will have limited possibilities though.
Also there are wrapper around OpenGl and SurfaceView like libgdx it is used mostly for games though - so it has much wider possibilities than you need, but it is less complicated than OpenGl.
Hope it helps.
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.
I have am developing a game in which most of the sprites are static (but animated). I found that using an imageview with drawable background (using xml) is giving me what I want. I may move those sprites based on user touches and have basic collision detection.
When I search the internet about the game development, most sites talk about either game engine or at least canvas/surface view. However in my case, I find deal with the normal android views and layout is enough to get me to going.
Is making a game using layout, image views and views something that is frown up? am I going on the wrong path with this?
Thanks
It all depends on the kind of game you want to make. If you are making a grid based game, ImageViews could be more useful. However, almost no one makes Android games using layouts. Most people choose to use SurfaceView because it allows much more to be done, and in my opinion if you choose to learn it you will make much better games.
Of course, this is all opinion but I know nobody who creates games using the layout editor.
I'm new in Android development and I have been making a tutorial for a game example which tells that using a layout file is not necessary because of the flexibility need on game development. However I've seen on Android docs that using a layout file is always the best way for Android development.
I'm sorry if my doubt looks obvious or kind of weird, but I'm really newbie and I'd really appreciate if you guys give me some help.
Most Android Games will use a Surface, Canvas, or GL Surface view to render all content to the screen. This element is likely to be fullscreen as well.
And so all drawing of UI and buttons and game elements are drawn directy to the surface, bypassing the use of Android's many UI views.
There is no reason you game cannot use android UI views in addition to using a surface for drawing the game action itself.
And of course you will likely use layouts as well when integrating things such as Admob ads or user dialogs within you game. So in practice you will use both.
But a standard utility application built in android will use layouts almost exclusively.
As a final aside, it is not necessary to use layouts. Every view type can be created either through XML layouts and inflating the views, or by instantiating a view in java code. the main reason for using layout files is because they are fast to build easy to use for a large category of interface design. But he choice to use them or not is your own.
A layout is used for arranging views. If you're not using any views (i.e. you do all the drawing yourself), then there's no point in using a layout.
For game development you are better off not using a layout file. The tutorial you are following is right. You will probably want to draw directly to a GL Surface View.
Personally, I forgo a lot of the features of the Android framework when doing game development. I use one Activity to bootstrap the game and get it running, and I draw to one GLSurfaceView. A lot of Android game dev tutorials follow this approach, and so are probably going to be a lot more useful to you than tutorials for more traditional Android apps.
my next project will be to develop a little game for android. In fact it will be more based on textual in- and outputs, so i don't need best hd graphics but nice looking "standard widgets".
I will mainly need Buttons, Checkboxes, RadioButtons, TextFields, SpinEdits so in general only the standard textual widgets. As i don't like the included ones in Android ("no looking cool enough", customization difficult, ..) i'm searching for alternative widgets or an possiblity to draw to them easily for example with an 2D framework. Themes are welcome.
Any hints?
you can use canvas, opengl or games engine, for example http://www.andengine.org/