Reputation: 44230
I was under the impression that 'dip' (Density Independent Pixel) values were the android solution to using % values to determine the width and height of layout elements. I thought this was an upgrade to using static 'px' (pixel) values or other static measurements like centimeter or inch.
Unfortunately dip values do not scale like a percentage value would, is there anything like percentage values with width and height parameters in Android?
Insight appreciated!
Upvotes: 2
Views: 5372
Reputation: 22040
As far as I know, the only way to do this is programmatically or by using layout_weight
See this link for info on layout_weight
Upvotes: 1
Reputation: 438
I had that same issue, but could not find an answer, so I switched to doing everything progmatically instead of within XML.. That's the only insight I can offer you. :P Sorry! In response to the other answer .. I never tried layout_weight.. Only layout_width and layout_height.. But if you're trying layout_weight and it doesn't accept floats, it might be a different ADK level. (I'm programming on ADK 7)
Upvotes: 0
Reputation: 5642
Something like this might work:
android:layout_weight=".70"
So that would be 70% of the space.
You would just add it to whichever value you want, like a button or textbox or something
Upvotes: 5