当屏幕尺寸不同时,我应该如何处理绝对位置?

问题描述

我想在 react-native 中使用 ImageBackground 在特定位置显示文本。

当使用resize mode as contains时,如何为不同的屏幕尺寸指定不同的绝对位置?

https://i.stack.imgur.com/HRUwn.png

 <ImageBackground
      source={require("../../assets/image.png")}
      style={{ width: "100%",height: "100%",position: "relative" }}
      resizeMode="contain"
      onLayout={(event) => this.setLayout(event.nativeEvent.layout)}
    >
      <Text
        style={{
          position: "absolute",left: 90,top: 300,}}
      >
        Text_1
      </Text>
      <Text
        style={{
          position: "absolute",left: 280,}}
      >
        Text_2
      </Text>
    </ImageBackground>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)