Programming a Likeable Android GUI? - android

I see a lot of these apps like Pulse that have really nice UIs on the android: http://cdn3.digitaltrends.com/wp-content/uploads/2011/04/Pulse-android-625x515.jpg
I want to make a UI similar to this: http://wpuploads.appadvice.com/wp-content/uploads/2012/06/3030-642x481.png where the text is editable/selectable/copyable. Basically an actual textfield, which I believe Android's canvas doesn't supply. How would I create UIs like this on Android. Android's normal xml layout in my opinion usually ends up making some pretty ugly stuff, and OpenGL might be a bit too high end for this kind of job. Any suggestions.
I tried looking around the forums and couldn't find anything really similar to this question? And I am not looking for a GUI builder, but more of something to actually develop the UI. Thanks!

As Mark says, they use normal XML layout. Personally, I've never looked at it, therefore I can't be sure, but I don't see anything "special" that couldn't be done with it either.
About the second app, I think it's even simpler than Pulse, probably. However, it's heavily customized (state drawables, probably), and you'd need StateListDrawable, a couple of 9patch graphics and the custom font you want to use.
If you're not familiar with customizing the appearance of controls, I suggest you start looking at those links above, and Google, of course.
One final note: designing a good UI is hard, let alone a custom UI where you start more or less from scratch, like those above. The Android UI provides a default look and feel that you can use... ICS being much better out of the box, but that's it (and at least it provides default tools to change that). If you can't do, or don't have the experience and/or skill, I suggest sticking to the defaults or outsourcing that job.
Good luck!

I tried looking around the forums and couldn't find anything really similar to this question?
That's because you already rejected the answer. Pulse is written using "Android's normal xml layout", as are most apps on Android outside of games.

Related

Which is the best way to implement this graphical design? (Android) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Hello everyone and thanks for your time.
Introduction to the problem: Basically the main problem is that I'm designing an android tablet application and I don't know exactly which is the best way to implement the kind of design I've been thinking about. I've been reading that is possible to use another platforms apart of Android, like OpenGL or HTML, but I don't actually know how to do it and if its necessary.
What do I attempt to do? I didn't know how to explain exactly which is my idea using words so I decided to prepare a small image about it, here it is:
So, the idea is to drag&drop the buttons to the color square, and detect if they are colliding, if that happens, start an event. Then all the buttons are going to be ordered again by themselves.
Which is the question then? I'm new at android, and I have no idea which is the best way to start implementing this, if I should bet for OpenGL or program directly in android. And in both cases, which is the best way START CREATING something like this?
Last things: I want to make clear something, just in case: This IS NOT any school work that someone asked me to do, I'm doing it by my own. I'm NOT ASKING PEOPLE TO DO MY WORK I'm just asking your opinion and asking for help and guidance about how to start managing this. (so I want your professional opinion, not any single line of code) :D
Thank you very much to you all. :)
Martí.
This sounds like it'd be pretty easy to do in HTML / JavaScript using touch events, maybe using a support library for drag/drop events. I don't know if it matters to you, but the nice thing with that solution is that it'd port pretty easily from Android to other mobile devices.
Like Quintin said, if performance is a big concern you can optimize and go to OpenGL, but you can probably knock out a simple prototype in HTML in under a day...
in my opinion you don't need any framework. You can do it all with android. I would also advise you to use android. I'm not a good designer, but my suggestion would be for this:
2x Framelayout, for the color tools on the left side and one for the rightside
For the color tools, for each 2 colors you can use LinearLayout. And if you want the exact backgraund design, you can design it with an image software and can set it in the background.
for the colors, you can use an imageButton.
And i also advice you to read the tutorials how to design apps, here is a good tutorial: http://mobile.tutsplus.com/tutorials/android/android-layout/
Open GL seems to be your best bet here. I haven't had much experience with Android OpenGL, but it is going to be the most efficient way to write the app - since you are dealing with collision detection and colours.
Android OpenGL will be the best option since it will be natively compiled by the ADK whereas HTML is going to be interpreted at runtime.
As far as using normal bland Android layouts, I would not recommend that, since this is not a "standard" UI using the standard components. You are creating an entirely unique interface that is very graphical, and so I would recommend sticking to that.
EDIT: You will find that by using standard layouts that ALL of your user interface components will have to be customized, and you will spend a lot of time in your onDraw() methods with the collision detection.
One problem with this is that you need to check whether the object collides with another object, making certain types of objects aware of each other, and may run the risk of circular references. Whereas if you use OpenGL, you can have one list of "Shape" types and then have a "checkCollision(Shape draggedObject)" method which iterates through the list of shapes and checks the collision using an optimized collision detection for the simplest object.
The second problem is doing collision detection in the onDraw() method will make your app lag and seem sticky to the user while performing a drag. The more components the more problems.
EDIT 2:
Here are some resources for Android OpenGL:
http://developer.android.com/guide/topics/graphics/opengl.html
http://www.learnopengles.com/android-lesson-one-getting-started/
2D example with OpenGL

Android layout examples that match "Metrics and Grids" recommendations

After trying to make sense of the Metrics and Grids page of the (fairly new) Android Design website, I gave up on a lot of things. So, basically, I'm trying to find the original layouts that are used in Android 4, so that I can apply the same concepts.
To make this question more objective and not fail under the "too broad" axe of stackoverflow, I ask you for the layout that is used to recreate, exactly and fully, the examples on that page. Did Google provide them in the samples? Maybe a well known didactic repository that strives to conform with standards?
Just as an example, it's not clear what to do to recreate the "48/3 metrics" (16/16/16) in order to make the text fit in it. What if I want to use 1-line of small text? Would it be 16/wrap_content/16, or 16/16/16 to make it consistent with other layouts around the set? What if...
I believe this would not only help the small devs, but also and most importantly, help standardize the look and feel of apps in Android Play. The site is a good start, but far from ideal.
Added details
I never asked a question with this much upvotes, and I didn't even expect that (I have other questions that I regard as "better", but by far not as many votes and favs). Not that I care about votes, of course, but that is to show that there is a great demand for what I'm asking (a bit of an ad populum here, but still...).
Replies to comments
#Ricardo Amaral:
I'm indeed sorry if I wasn't clear enough:
Mandating a standard and requesting unambiguity from it are different issues. One of the reasons I like Android is the degree of freedom we have, so I'm very much aware of the impossibility of mandating most of the common practices.
I believe it relates to the concept of "reinvent the wheel" within the concept of freedom.
Again, those were just examples. Some things are not clear... which are paddings of the outer container, and margins of the inner views? Many times that makes a difference in selectors, dragging etc. etc. etc., and that again translates into a familiar look and feel for the user. One thing feels like splitting hairs, but it quickly adds up to a lot of small differences. And the user notices it... it looks like it lacks that last "finishing touch".
#Michael Slade:
I know they're examples, that they may have been wireframed from templates. As said, I'm already reusing code from the SDK, and I know they're just examples and that we can deviate from them. Again, after all this time, nobody answered.
Optionality benefits from precision. That's what I'm trying to say and ask. Because it's a recommendation doesn't mean its guidelines can be whatever you want them to be. If you do that, it's not the recommendation anymore. That's the whole point of recommendations, by the way: provide an implementarion theory without forcing anyone.
Thanks everyone!
Hate to break it to you but it's likely that the images on the page you like were created with a drawing program, and there are no example to go with them.
Without someone actually going to the effort to create samples for you, your best bet is to go through the samples that come with the android SDK - they will follow the guidelines in most cases.
And remember, they are just guidelines. At the end of the day it's up to you to create a pleasant and smooth user experience, however you see fit.

Best practices: Layouts on Android (Programmatic vs XML)

This question has been bugging me for some time. I've already developed a couple of apps on the Android platform and somehow always find myself resorting to Java code in order to construct the layouts. In a professional development environment, is this acceptable? Or should XML files be the go-to approach? I usually find XML a more tedious approach and often, these layouts don't look the same on all devices. I just don't get it. From a professional viewpoint, has anyone really been able to develop apps with complex views purely using XML files? This question is killing me because Google recommends using XML but the UI never looks the same on all devices unless done programmatically. Or am I doing something wrong?
Note that I'm referring to Android 2.2 and 2.3, which majority of the users use.
I use XML layouts on pretty much every fragment and activity of every app I write. I very rarely see any need to create Views dynamically, tho configuration of ListViews, showing/hiding views, etc needs doing in code. For me the advantages of XML are:
Ability to use layout editors (Eclipse)
Easier to preview layouts
Possible to benefit from auto-localisation of layouts
Easily maintain different parallel layouts for difference devices (screens)
Can get a sense of the layout by looking at it (easier than code)
Easy to break layouts down into pieces (fragments, includes, etc) to remove duplication
Keeps a separation between the visual design, and the functionality behind it
I can't think of any good reasons to put all my layouts into code - that sounds like hell.
I expect the reason your layouts don't look the same is because your XML is not defining the layouts correctly. Bear in mind the Android tools convert XML layouts into code, so there's no inherent problem with using XML layouts versus dynamic - both end up as code.
OckhamsRazor,
The answer very much depends on your needs, flexibility, and knowledge. The first thing to understand is that every Layout, whether created via XML or programmatically can be tweaked specifically or made to conform to many screens via properties.
... and somehow always find myself resorting to Java code in order to construct the layouts. In a professional development environment, is this acceptable?
Yes, it is. Android makes those available so you can do just that. However, the benefits of managing layouts via XML include standard MVC segregation, simpler debugging, and an easier time modifying the resource, if needed. Additionally, you may maintain multiple copies of Layouts depending on device configuration easily.
... has anyone really been able to develop apps with complex views purely using XML files?
Absolutely! There are some amazing programs that fully utilize XML rather than programmatic views. The key to them is how much information (that is non-standard view properties) is required from parental Views. Even in those cases there are ways to pass that information provided you know where and how to do so.
Or am I doing something wrong?
I don't think so. Honestly, I've run both ways depending on need. I'd say it really comes down to your lack of knowledge of the quirks. But the job is to get the job done. Here's an example: There are some times when I don't know how big everything needs to be until its run on the device, and there are times that I make the device conform to my layout's needs. Ultimately, I use the following chart to make my determinations.
Do I need information from parental Layouts that is aside from view properties
Do I need to dynamically size more than one element independently.
Is the View type pre-determined or will it change as well?
If the answer to 2 out of 3 of those is "yes", I will use some level of programmatic layout. If not, I will go pure XML. That being said, programming is one of those professions that encourages ingenuity (provided it is safe) and nearly anything can be accomplished in any number of ways. Ultimately, I'd say do whatever makes your job making quality apps easier.
Google makes its recommendations based on their own knowledge of software programmers and their general practices. They also created the platform, so they know which things are optimized in which ways. Its all about experience and we all have our own. If you have trouble utilizing XML, its worth taking the time to figure out the quirks simply so that it is another tool to utilize. Also, it will give you the information you need to answer this question for yourself.
To sum things up: I could say chocolate is better, but if you like vanilla, you'll disagree. Be aware of the drawbacks and benefits of each and take the time to learn how to accomplish the same tasks with both methods. It will make you a better programmer and give you a better sense of when to use which technique.
Hope this helps,
FuzzicalLogic
I typically do a lot of work with highly customizable UIs, where large portions of it need to be done in code. That being said, wherever possible I try to use layout fragments and inflate them, so as UI sections are added, removed, or rearranged I'm still just doing some of the layout, not all of it.
That being said, it's not that hard doing layout via code. The big advantage to it is compile-time checking. I'll find issues that way faster than using the preview pane. The preview pane can be nice for initial layout, but I use the Hierarchy Viewer for figuring out why my layouts don't look right.
It really depends on what type of project it is, or piece of a project, and what type of programmer you are. Some people just prefer pure code, while others like leaning as much on other tools for design as possible.
XML definitely has some benefits, like being able to switch between interface designs quickly. For specific design themes that are repetitive, is definitely useful for most programmers.
I personally prefer doing everything programmatically, and it is quicker for me to develop than writing XML, with the libraries and classes I have created. XML is quicker straight out of the box.
As for performance, there really isn't a difference worth mentioning unless you are using the same view so repetitively, at the same time, to the point that it no longer fits on the screen many fold. I did a test of how many text views Android could render on a Moto X - Android 4.4, and it couldn't get much over 5000, but there is never a purpose for that. If you are at that point, you are either need to dynamically load and unload data or are just doing something very wrong to begin with.
So learn both sides of it, definitely get to know the pros and cons with your style of programming, because there is no right answer for everyone, and let loose and have fun.
It is much better to separate the layout and put it in the xml file. I occasionally have to adjust the layout in code, but it is always an exception and only when I determine that it cannot be done in the layout .xml. If you use the layout views correctly, the application should look very similar on all devices.

Create a Custom Android App UI

I am not familiar with creating android apps by any means. However my company is looking to have an app build up. First they would like to have someone design a custom UI for it. However most apps I use at least all generally have the same core UI look/feel which is something we would like to avoid. I have seen apps though that don't even remotely look like the rest. So I am wondering if theres any place to find out what the basic canvas of an android app looks like . Is there any PSD's anywhere for this? Not one hundred percent sure what I am looking for other than concepts at the moment, but we want to know that our concepts are at the least plausible. So if anyone knows any good resources Id be interested to know.
Not PSDs, but you should take a look at the newly launched Android Design site, especially the Building Blocks section to understand what is available out of the box for you. Pretty much all of the controls you can style pretty extensively if you're willing to put the work into it, but have varying degrees of built-in configurable styling flexibility.
Note that while there's something to be said for ingenuity and being able to stand out from the crowd, there's also the flip side of comfort and usability for the user that comes with a familiar look and feel. If you're looking to come up with your own custom controls, etc. and you're not even familiar with creating Android apps, I hope your company is willing to budget a lot of time for the steep learning curve (the learning curve of Android is not so bad, but adding a lot of custom UI on top of that is not trivial for a first project).

Is there a good quality interface "painter" for Android on Eclipse

I've been through the Android tutorials - these do a good job of introducing how we can hand-roll an Android user-interface. Actually, I do not need that level of control right now... I'm looking for something simpler...
I'd like to make an Android app which will mainly contain a number of standard UI widgets, nothing particularly fancy. Having done some VB development a long time ago (yes, I know it's crap!) - I particularly like the ability to paint user-interfaces with an interface designer and then add in the relevant callbacks via the IDE. I'm using Eclipse, so for now solutions requiring net-beans or other IDEs are not particularly helpful.
I'm well aware that this practice often produces sub-optimal code, and less than beautiful interfaces. That's not really a concern here. I just need to produce a certain effect quickly in order to prove a concept. There will be plenty of time later on for optimization if my idea is good enough.
If you create a layout xml file you get "drag/drop" for the activity layout. It's not perfect, but you should be able to accomplish what you're asking for.
How you were used to VB development won't work out for you.
You will have to create your interface in XML, and put events to the objects by code. There is DroidDraw but it won't get you further then the plain inbuilt IDE of Eclipse.
When creating XML layouts think like it a HTML layout, nested objects, tables/linearlayouts etc...

Categories

Resources