android - 在 XML 中可以用两种以上的颜色绘制吗?
解决方案
在 XML 中的 drawable 中实现这一点。
首先,您需要创建一个可绘制文件。
然后,添加这些代码行。
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#00000000">
<item>
<shape android:shape="rectangle">
<padding
android:left="10dp"
android:right="10dp"/>
<gradient
android:startColor="@color/purple_500"
android:endColor="@color/purple_200"
android:angle="0"/>
</shape>
</item>
<item>
<shape android:shape="rectangle">
<gradient
android:startColor="@color/white"
android:angle="90"/>
</shape>
</item>
</ripple>
然后在android中的任何地方使用drawable文件。
推荐阅读
- python - 卡在 find_element_by_xpath
- angular - Angular 7 Hot Reload 挂起
- mysql - SQL 语句混乱,时间戳返回不准确的结果
- elasticsearch - 有没有办法在 kibana/elasticsearch 中进行主索引?
- python - 阅读文档本地安装:Celery ValueError: signal only works in main thread
- json - 如何从 Swfit 中的复杂 JSON (Google Books API) 中仅获取某些值
- linux - 使用 sys_brk 在 Linux 上的 Intel Assembly 中进行动态内存分配
- amazon-web-services - 在 docker 中找不到 aws 命令
- css - 为什么范围样式没有加载到 nuxt 页面中?
- flutter - Flutter:TextFormField 上的 onTap 仅在热重载后触发