- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我在 react-native 中使用时,它会警告说不推荐使用与 child 一起使用,并且将来会出错。取而代之的是用户。
所以,
如果我使用它不会给出我正在使用的预期结果
这是我为使用而编写的代码
<ImageBackground source={require('../../img/splash/splash_bg.png')} style={styles.backgroundImage} >
</ImageBackground>
const styles = StyleSheet.create({
backgroundImage: {
flex: 1,
// width: undefined,
// height: undefined,
// flexDirection: 'column',
// backgroundColor:'transparent',
// justifyContent: 'flex-start',
},}
最佳答案
您可以使用"ImageBackground" React Native 上的组件。
<ImageBackground
source={yourSourceFile}
style={{width: '100%', height: '100%'}}
>
<....yourContent...>
</ImageBackground>
关于javascript - 如何使用 ImageBackground 为 react-native 中的屏幕设置背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46886953/
我最近更新了 React-native,它引入了一个警告,代码如下: foobar 还有警告: index.ios.bundle:50435 Using with chil
我已经提供了一个 ImageBackground 组件,我希望它占据整个屏幕,但即使我将图像的大小调整两倍或更多,它似乎也有小填充。它从哪里来? Here is the code of the com
我想要一个占据所有屏幕并在我滚动时保持静止的背景图像。 我在 React Native 元素中有这个组件: .... 它正在包装另一个组件,它有这样的风格: backgroundImage:
这里的任何人都可以帮助我使 resizeMode 与 一起工作? resizeMode 应用到 View 时会报错。 ,显然不支持它。 但我需要找到一种解决方法,因为我发现使用起来相当复杂 作为带有
我有一个带有图像横幅的水平平面列表。问题是宽度随着内部文本的增加而增加。我想要固定图像宽度。请建议我处理这个问题的有效方法。我将在下面分享我的代码。 const carData = [ {
即使我可以更改屏幕方向以更新状态并重新渲染,ImageBackground 组件仍然不会更新其宽度。 我有以下代码: this.mylayoutchange(event)} style={{ f
我有一张图片,我试图在上面放置一些文字。 为此,我使用 ImageBackground 来拥有图像的子元素。 然而,图片在小型设备上会被缩小,如果可能的话,图片会被缩小 当我将我的文本居中时,它会在整
我一直在尝试开发下面提到的屏幕: 为此,我创建了以下组件: import React, {Component} from 'react'; import {View, Text, StyleSheet
在我的 react-native expo 应用程序中,我有一个背景图像在所有屏幕上都占据全高和全宽,我想在背景图像上方放置一个线性渐变,但它不起作用,图像总是出现在渐变上方,这里是编码: i
我正在尝试创建一个带有文本的图像,为了清楚地看到文本,我需要使图像变暗。 另外(不确定它是否重要)我需要背景图像是可触摸的。 这个问题在这里被问了好几次,我看到了一些答案,但没有一个对我有用,所以我想
当我在 react-native 中使用时,它会警告说不推荐使用与 child 一起使用,并且将来会出错。取而代之的是用户。 所以, 如果我使用它不会给出我正在使用的预期结果 这是我为使用而编写的代码
目前,当您在我们的登录页面上的文本字段内单击时,ImageBackground 会调整大小或移动。我尝试将 resizeMode 设置为其所有潜在选项,但没有一个有帮助。如何在不使用 Keyboard
我正在使用 ImageBackground 来自 React Native 的组件。但是,无论我选择什么样式,总是会显示相同的错误消息。代码如下所示: render() { return (
当我将 imageStyle 位置设置为 relative 时,我的 imagebackground 包装器中的文本不显示。 this.onPressInMic()} onPressOut=
我目前正在使用以下代码在我的 React Native 应用程序上显示背景图片: .... 我不希望我的图像被拉伸(stretch),而 resizeMode: 'contain' 完美地完成了这
所以我在 react native 中设置背景图像,但我需要将背景图像的位置设置为底部。所以如果有人知道如何实现这一点。 我曾尝试添加 backgroundPosition 但它似乎不受支持 L
我是一名优秀的程序员,十分优秀!