Android unit of length and inner and outer margins

  1. The PX unit of distance

    What is the pixel

    What is DPI

    dpi( dots per inch) = (fine screen)

    Dots per inch, size screen size, such as 4.3 inches


  2. The DP unit of distance


    dp= dip(Device Independent pixels)

    (device independent pixels)

    Conversion formula PX = DP*(dpi/160)

    In the DPI 160's screen: 1dp = 1px

    320

    640


    dpi=160

    dpi=320

    160px=160dp*(160/160)

    320px=160dp*(320/160)

  3. The SP unit of distance

    1 (font size)

    2 when the user to modify the mobile phone display fonts, SP will change


  4. Control of the margins and padding

    The outer margin

    Padding

    layout_margin

    The outer margin

    padding

    Padding

    layout_marginTop

    Margin

    paddingTop

    On the inner margin

    layout_marginButton

    Lower margins

    paddingBottom

    In the margin

    layout_marginLeft

    Left margin

    paddingLeft

    A left padding

    layout_marginRight

    Right margin

    paddingRight

    The right margin

Posted by Chasel at November 19, 2013 - 1:02 PM