【发布时间】:2016-04-02 07:03:25
【问题描述】:
我正在为一个开源项目做贡献,我正在为 React Native 开发材料设计。我在工作中受阻,无法对 UI 级别进行一些增强。填充、对齐等,
这是抽屉材料设计的官方规范-
在上图中,测量的UNIT为dp。
但是,在我的 React Native 代码中,我发现没有提到这样的单元。考虑到它是“react native”,我很困惑它是 px 还是 dp。
我什至查看了React Native for Style 组件的官方文档。我在任何地方都没有看到提及。
我的代码看起来像-
const styles = {
touchable: {
paddingHorizontal: 16,
marginVertical: 8,
height: 48
},
item: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
},
icon: {
position: 'relative',
},
value: {
flex: 1,
paddingLeft: 34,
top: 2
},
label: {
top: 2
}
},
请你告诉我,这是像素还是 dp?还有,是1px = 1dp吗?
【问题讨论】:
标签: android css reactjs material-design react-native