Android: 'dp' to 'px' conversion?

前端 未结 4 1401
失恋的感觉
失恋的感觉 2021-02-13 20:47

I am reading this article: http://developer.android.com/guide/practices/screens_support.html

It says that the formula Android uses to convert between a dp

4条回答
  •  花落未央
    2021-02-13 21:11

    If what I've read is correct, 1.5px means the single '1' pixel is a color specified, and the .5 of a pixel surrounding it will be a blend with the '1' pixel and a pixel next to it.

    E.g.

    | A | AB | B |

    A is 1.5px and B is 1.5x, therefore the pixel in-between is a mixture of both.

    So using that, two pixels next to each other will be blended together e.g with a 1px display

    | X | Y |

    Now with a 1.5px display:

    | XY | YX | It becomes mix of both! but the pixel set as X will be more X than the pixel set as Y

提交回复
热议问题