React-Native :React Native 可以找出每个设备的确切绝对位置吗?

问题描述

我想使用绝对位置在图像上显示文本。 但是,由于每个设备的屏幕尺寸不同,因此很难确定确切的位置。

有没有办法计算准确的位置?

我发布了一个类似的问题,但没有得到我想要的答案。 my first question

enter image description here

下面是我试过的代码。

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

解决方法

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

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

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