开发者

Android actual auto-scaling width/height parameters?

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 Androi开发者_开发百科d?

Insight appreciated!


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


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


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜