3

I have been working on android for the last 6 months. I wonder why UI Design is done in "dp"s. It would be great if its mentioned in "%" instead of dp's. What i meant to say is assuming total width and height of the screen to "100%" we can divide the width and height of the each widget. may be like this:

<ImageView android:layout_width="20%" android:layout_height="20%" />

So that every screen automatically takes it. Offcourse "wrap_content" and "fill_parent" can do. But cant use them to all views. I dont know if its possible or not.

Seshu Vinay
  • 13,560
  • 9
  • 60
  • 109

2 Answers2

2

It's just the UI design aspect of Google that it's not possible to do what you intend to. That's 'cuz the layout height and width take integer values. However, layout weight takes decimal values in the form of percentage. So, in a way it's possible to do what you're trying to, but only with weight and not with height or width. +1 for the question.

Ghost
  • 3,966
  • 1
  • 25
  • 36
  • Yea, I know its not possible. I just said it would be great if we had that. It would be as simple as we design simple HTML Websites. – Seshu Vinay Dec 24 '11 at 07:28
  • Surely, it'll be nice. Good idea on implementation basis. I wonder if it's possible by messing up with the Android OS source code. But it's always risky. If you're exceptionally good with coding, I guess you can give it a good shot. – Ghost Dec 24 '11 at 07:39
1

i think you cant use "%" in layout xml, you can use layout weight

Mohammed Azharuddin Shaikh
  • 41,633
  • 14
  • 96
  • 115