Sign in to follow this  
futlib

Android: Activities and layouts or a single custom view?


Recommended Posts

I'm really interested in what's more common. Please note that the first option does not imply that you don't use custom view's at all, but that you don't write a single custom view that displays across the whole screen and takes control of any layouting and positioning.

I've tried to use the activity and layout system where possible so far. That is, for each scene of the game, I'm using a different activity, and whenever possible, I use a layout to arrange the screen. I've run into some shortcomings of the activity and layout system though, so I'm currently doing a mixture of both, and I'm considering moving to the single custom view approach. That would also have the benefit of being less Android specific and thus easier to port.

Share this post


Link to post
Share on other sites
I'm just starting android development and have a rudimentary top down scrolling shooter working at the moment, I decided to go right for a single custom SurfaceView implementation to be used for the entirety of my development. This of course may change in the future but it's working out quite well so far.

If you like using pre-built buttons and sliders and other canned UI widgets use the built in view layouts and all that jazz... if you would prefer to get a black screen and use it as a blank canvas to draw all custom content with bitmaps and/or graphics primitives then just override the SurfaceView class and have at it.

Share this post


Link to post
Share on other sites
For me, I like a black surfaceView and draw everything on it. Map, sprites, items, text, menus, touch screen controls. Gives me good freedom and doesn't deter the player from realizing he or she is on a phone or something. I want the player to feel as if he or she is using a handheld gaming system.

Share this post


Link to post
Share on other sites
I'm pretty sure that SurfaceView is the best choice for games while layouts are widely used in different applications and tools (they can really simplify the development while being customizable as well). Actually there can not be a strict rule of course, when you have a task you usually can decide on this two approaches.
For me single custom view is a preferred choice anyway :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this