现在的位置: 首页 > 综合 > 正文

Dimension Resources

2013年08月02日 ⁄ 综合 ⁄ 共 600字 ⁄ 字号 评论关闭

Pixels, inches, and points are all examples of dimensions that can play a part in XML layouts
or Java code. You can use these dimension resources to style and localize Android UIs without
changing the source code.

<resources>
<dimen name="mysize_in_pixels">1px</dimen>
<dimen name="mysize_in_dp">5dp</dimen>
<dimen name="medium_size">100sp</dimen>
</resources>

You could specify the dimensions in any of the following units:
• px: Pixels
• in: Inches
• mm: Millimeters
• pt: Points
•dp: Density-independent pixels based on a 160-dpi (pixel density per inch) screen
(dimensions adjust to screen density)
• sp: Scale-independent pixels (dimensions that allow for user sizing; helpful for use in
fonts)

抱歉!评论已关闭.