android - 使用渐变颜色反应原生 ActivityIndicator
问题描述
可以在 android 上创建具有渐变颜色的 ActivityIndicator 吗?我尝试使用 react-native-linear-gradient 库并像这样实现:
<ActivityIndicator
size="large"
color={
<LinearGradient
colors={['#37ca93', '#4a5de2']}
start={{ x: 0, y: 0 }}
end={{ x: 1, y: 0 }}
/>
}
/>
但这是行不通的。
解决方案
这是不可能的,因为color
道具必须是字符串值https://reactnative.dev/docs/activityindicator#color但您尝试传递一个组件。
您可以尝试使用自定义组件,例如这里https://github.com/oblador/react-native-progress/issues/144#issuecomment-481419746
推荐阅读
- c# - SignalR 可以包含控制器逻辑并执行 CRUD 操作吗?
- r - 如何合并R中频率表上的属性?
- excel - VBA:如何将所需格式的文本传递到不同的单元格
- html - 具有更大或更短文本的 div 中的宽度相同
- tsql - 如何根据 CASE 逻辑更新表?
- c++ - 是 std::chrono::duration 默认初始化为 0
- python - Conda 没有看到已安装的模块
- python-3.x - 如何使用 Python 和 ask-sdk(意图链接)将意图委托给 Alexa?
- ios - 对至少未渲染一次的视图 (_UIReplicantView) 进行快照需要 afterScreenUpdates:YES
- python - Opencv(在python中)给出错误-函数'cv2 :: cvtColor'中的!_src.empty()