Avoid using "px" as units; use "dp" instead
2012-11-08 15:33
357 查看
android开发当中,在为应用程序布局时,用到了:
android:textSize="24px"
这时发现编译器警告:
Avoid using "px" as units; use "dp" instead
google让我们避免使用px单位了,这是因为px单位大小始终是固定的,而dp单位的大小却可以随着屏幕的大小而改变,所以使用dp可以使应用程序适应任何尺寸的屏幕而不改变UI比例的大小。
android:textSize="24px"
这时发现编译器警告:
Avoid using "px" as units; use "dp" instead
google让我们避免使用px单位了,这是因为px单位大小始终是固定的,而dp单位的大小却可以随着屏幕的大小而改变,所以使用dp可以使应用程序适应任何尺寸的屏幕而不改变UI比例的大小。
相关文章推荐
- Avoid using "px" as units; use "dp" instead
- Avoid using "px" as units; use "dp" instead
- 关于iview中[Vue warn]: Avoid using non-primitive value as key, use string/number value instead.影响性能的问题
- 解决element-ui upload组件报错 Avoid using non-primitive value as key, use string/number value instead
- 关于http客户端常见错误"警告:Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is rec"
- #("The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name:")
- Avoid Using The “system("pause")” !
- Avoid to use "IN", "NOT IN" in SQL statement, try to use "LEFT JOIN" instead.
- error C2275: "xxx"illegal use of this type as an expression
- [常见错误 及 解决方案系列]USE " cc.exports.* = value " INSTEAD OF SET GLOBAL VARIABLE"
- [常见错误 及 解决方案系列]USE " cc.exports.* = value " INSTEAD OF SET GLOBAL VARIABLE"
- Freemaker:you just want "true"/"false" result as you are generting computer-language output, use "?c
- 官方论坛的帖子 How about use "armeabi-v7a" as default ABI on Android for template? ABI 是啥?
- ReactNative.createElement is deprecated. Use React.createElement from the "react" package instead.
- composer install 时,提示:Package yiisoft/yii2-codeception is abandoned, you should avoid using it. Use codeception/codeception instead.的解决
- 解决Package illuminate/html is abandoned, you should avoid using it. Use laravelcollective/html instead.问题
- warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _
- error: #error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."解决
- Do not hardcode "/data/"; use Context.getFilesDir().getPath() instead 解决方法
- 关于http客户端常见错误"警告:Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.