Baba
Baba

Reputation: 63

Making UI Generic For Every Phone

Making an application for android i noticed that the layout view on eclipse is different from the application layout view on my phone when i run my application on the phone. Talking about the position of widgets including buttons, image view, custom views. The placement is different in the application layout view on eclipse from that on phone. I was thinking that this means it would variate on different models of the android phones on which the application would be run. How can i make my view generic in order to cater this issue so that the position of the widgets be same no matter where the application is being run? Is it possible to cater this issue?

Upvotes: 1

Views: 512

Answers (2)

Simon
Simon

Reputation: 13283

I did this to generate UI elements which fit on any phone and have abstraction what elements I want to show and how they will look like:

SimpleUi ( https://github.com/bitstars/SimpleUi )

The generated UI (code below):

enter image description here

The complete code to create this Android UI:

enter image description here

I use it in real applications, not only for fast prototyping or dialogs and its well tested over the years. The concept is based on the model view control principle and for most common scenarios there are ready to use components which automatically look correct on any device. I don't say it should be used for any UI (e.g. listviews should be done by hand) but for most usecases this should be quite handy ;) Oh and feel free to fork it and improve it further if you want

Upvotes: 0

Alec.
Alec.

Reputation: 5525

As Henry suggested in the comment, this Android dev article should be able to make all your dreams come true.

http://developer.android.com/guide/practices/screens_support.html

Literary everything you could ever need to know about formating for different size screens is in that.

Upvotes: 1

Related Questions