Html 反应本机图标未在视图中心对齐
这是我用背景色在圆形视图中心创建图标位置的代码:Html 反应本机图标未在视图中心对齐,html,react-native,Html,React Native,这是我用背景色在圆形视图中心创建图标位置的代码: import EEIcon from "react-native-vector-icons/Entypo"; <View style={{ backgroundColor: "#F2F2F2", alignItems: "center", justify
import EEIcon from "react-native-vector-icons/Entypo";
<View
style={{
backgroundColor: "#F2F2F2",
alignItems: "center",
justifyContent: "center",
height: 25,
width: 25,
borderRadius: 12.5
}}
>
<EEIcon
name="location-pin"
style={{ color: "#fff", fontSize: 15 }}
/>
</View>
为了使alignItem和justifyContent正常工作,display应设置为“flex”:
style={{
backgroundColor: "#F2F2F2",
alignItems: "center",
justifyContent: "center",
height: 25,
width: 25,
borderRadius: 12.5,
display:"flex"
}}
从顶部和左侧为图标添加填充--
<EEIcon name="location-pin" style={{ color: "#fff", fontSize: 15, paddingTop:3, paddingLeft:2 }} />
下面是一个工作示例