Search code examples
androidxmlheightwidthdensity-independent-pixel

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 Android?

Insight appreciated!


Solution

  • 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