Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native paddingTop的行为似乎是随机的_React Native - Fatal编程技术网

React native paddingTop的行为似乎是随机的

React native paddingTop的行为似乎是随机的,react-native,React Native,我正在尝试使用以下样式为我的应用程序原型添加图标: swordIcon:{ position: "absolute", alignSelf: 'flex-start', paddingTop: "42%" } 然而,它的位置是不一致的,有时是随机的。屏幕截图将表示: 我想有一次它也是介于两者之间的 为什么会这样?下面是父元素的样式(如果有帮助): container: { flex: 1, borderColor: "red", border

我正在尝试使用以下样式为我的应用程序原型添加图标:

swordIcon:{
    position: "absolute",
    alignSelf: 'flex-start',
    paddingTop: "42%"
}
然而,它的位置是不一致的,有时是随机的。屏幕截图将表示:

我想有一次它也是介于两者之间的

为什么会这样?下面是父元素的样式(如果有帮助):

container: {
    flex: 1,
    borderColor: "red",
    borderWidth: 1,
    alignItems: "center",
    paddingTop: "5%",
    flexDirection: "column"
},

尝试使用debug菜单中的inspector,看看它是否有助于发现问题!你的相对位置在哪里?