cuốn sách gpt4 ai đã làm

android - 在另一个 : React Native 之上叠加或添加 View

In lại Tác giả: Hồ Xil 更新时间:2023-11-01 03:51:07 25 4
mua khóa gpt4 Nike

我正在尝试添加 hiện hữu .应该看起来像这样 -

nhập mô tả hình ảnh ở đây

这是我的代码 -

<>
mapType='standard'
style={styles.map}
region={{
latitude: selectedLoc.location.latitude,
longitude: selectedLoc.location.longitude,
latitudeDelta: 0.005,
longitudeDelta: 0.005
}}
onRegionChange={() => { } }
onRegionChangeComplete={() => { } }
showsUserLocation={false}
zoomEnabled={false}
draggable={false}
annotations={[{
longitude: selectedLoc.location.latitude,
latitude: selectedLoc.location.longitude,
title: selectedLoc.title
}]}
initialRegion={{
latitude: selectedLoc.location.latitude,
longitude: selectedLoc.location.longitude
}}>
<>
style={{
width: 50,
height: 50,
}}
resizeMode={"contain"}
source={{ uri: 'https://unsplash.it/50/50/?random' }}
/>

我没有从这段代码中获得任何顶部 View 。请告诉我

câu trả lời hay nhất

首先,你必须了解一些关于react-native View 配置的规则。在 iOS 上,重叠 View 以渲染方法中指定的相同顺序呈现(如果您有两个 View ,第二个将是最可见的)。在 Android 上,重叠的 View 、超出范围的 View 将被切断。

无论如何,在您的情况下,您不能只添加具有高度和宽度的图像。你必须提供这个的配置。

我建议你添加一些样式:

{ position: 'absolute',
bottom: 10,
right: 10,
width: 50,
height: 50 }

使用此样式,您的图像应显示在 map 的右下角。

关于android - 在另一个 : React Native 之上叠加或添加 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37458969/

25 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress