【问题标题】:Setting the size in RN's ImageBackground equal to the image used在 RN 的 ImageBackground 中设置大小等于使用的图像
【发布时间】:2020-08-11 06:53:49
【问题描述】:

我正在使用来自 React Native 的 ImageBackground 并且我正在使用背景。我想用背景的大小来设置元素的大小。

<ImageBackground source={require("../images/Image.png")}>
  <Text>Hello World!</Text>
</ImageBackground>

谢谢!

【问题讨论】:

    标签: reactjs react-native imagebackground


    【解决方案1】:

    定义heightImageBackground

    <ImageBackground style={{height: 300}} source={require("../images/Image.png")}>
      <Text>Hello World!</Text>
    </ImageBackground>
    

    【讨论】:

    • 谢谢,不过我希望该高度与 Image.png 大小相同。也许在 cmets 上还不清楚!
    • 相同吗?能否请您详细说明一下。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-03
    • 2016-10-06
    • 1970-01-01
    • 2018-02-08
    相关资源
    最近更新 更多