Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Designing lots of UI screens for Android

 
Johan Pelgrim
Ranch Hand
Posts: 105
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jason,

Compared to Apple's Interface Builder and even Windows Mobile 7's graphical design tools the ADT-plugin's Visual Layout Editor is not that mature (yet, I hope). What is your experience with designing user interfaces in Android? Mine is that it can take a lot of time to get it right. If you have a large project, with e.g. 40 Android UI activities (why not) what is your preferred way of creating all those layouts? Do you simply delve into the XML, or do you use some procedural parts, do you reuse stuff, or... do you even use the Visual Layout Editor? Do you know the ADT-team and do you know where it is headed?

Cheers,

Johan
 
Jason Brent Morris
author
Greenhorn
Posts: 10
Android Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Johan,

This is very much a personal opinion, but I generally prefer to write user interface layouts by hand.

In Android in particular, I find that developing layouts by hand encourages you to reuse of layout elements. Reusing layout elements improves consistency, which in-turn improves user experience. It also makes maintaining your application much easier. Using the <include> tag in your layout resources gives you significantly more flexibility with the resource loader, since each included layout file is selected separately to the layout file including it. Visual Layout tools tend to make these interactions, and interactions between your layout XML and source code rather difficult. I've found that writing the code by hand lets you mix-and-match XML layouts and widgets created in Java code more easily, something I discuss at more length in the book. With the number of screens you're suggesting (40 odd) there should be a fair amount of commonality, and therefore plenty of opportunity to reuse parts of the layout XML.

As you say: getting a user interface right takes time, but I find it's always something that takes time. I personally enjoy sketching user interfaces out on paper a few times before actually getting to work on them. Paper and pencil serves two purposes for me: it helps me organize my thoughts and ideas on the user interface away from the constraints of the platform I'll be implementing on (in much the same way as many web designers will do much of their work in Photoshop instead of an HTML tool). Secondly: I find it much easier to then figure out what widgets and layouts will be needed, generally by drawing boxes around sections of the layout.

On the ADT plugin specifically: I don't know the ADT team personally, nor where they plan on taking the project.

Cyas,
Jason
 
Johan Pelgrim
Ranch Hand
Posts: 105
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jason,

Thanks again for an elaborate answer!

With "developing layouts by hand" you mean the declaritive route / XML, right? Not the procedural form / in (Java) code?

Cheers,

Johan
 
Jason Brent Morris
author
Greenhorn
Posts: 10
Android Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again Johan,

When I say developing layouts by hand, I mean with XML and Java. Some layouts are more rigid and can be built with just XML, but there are times when you need some Java code. I try to shy away from pure Java code when it comes to Android layouts, opting to load bits of the layout with a LayoutInflator instead and then injecting data as required.

This offers the best of both worlds: you're able to build more complex layouts than you can with just XML, but also don't loose any of the great resource loading magic that Android provides.

Cyas,
Jason
 
Johan Pelgrim
Ranch Hand
Posts: 105
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again Jason!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic