android - 与文本内联的 React-native 图标
问题描述
嗨我想实现以下风格:
但是使用以下代码,我在单独的列中获得了一个图标,在另一列中获得了文本
<View style={{flex:1, flexDirection:'row'}}>
<Icon height={10} width={10} />
<Text>It is a long established fact that a reader will be distracted by the readable
content of a page when looking at its layout. The point of using Lorem Ipsum is that it
has a more-or-less normal distribution of letters, as opposed to using 'Content here,
content here'
</Text>
</View>
请忽略不同的图标。这个问题有什么解决办法吗?
解决方案
实际上,您可以在文本中嵌入图标,如下所示:
<View style={{flex:1, flexDirection:'row'}}>
<Text>
<Icon height={10} width={10} />
It is a long established fact that a reader will be distracted by the readable
content of a page when looking at its layout. The point of using Lorem Ipsum is that it
has a more-or-less normal distribution of letters, as opposed to using
'Content here, content here'
</Text>
</View>
推荐阅读
- c++11 - 可变参数模板继承中的运算符重载
- python - 在 for 循环之后停止对 gzip 压缩的文本文件的迭代
- python - 如何使用 MATLAB 内核运行 Python 代码以加速计算?
- javascript - 在 codeigniter 和 JavaScript 中自动增加序列号
- swift - 将图像添加到 swift Playground [iPad]
- java - 使用 xml 中的字段类型将 XML 解析为 java 对象
- scala - 将s3“目录”复制到本地目录
- php - 我无法使用 Laravel 和 Dropzone.js 上传文件
- java - 为什么使用 2 的幂来实现 HashMap?
- excel - 使用类对象将数据文件汇总到字典中