Android“高级”渐变 - “拇指”职位?
我正在尝试创建一个渐变绘图来描绘某物的比例。作为一般示例,假设您正在查看包含车队的列表视图。背景可以是电量计 - 我不想要平滑、宽阔的过渡。我想要一个非常紧密的过渡,并且我希望能够设置过渡发生的位置。
这就是我正在盯着的东西,但我还没有走得太远。
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#D2E3D3"
android:endColor="#E6E6E3"
android:angle="0"
/>
<corners android:radius="0dp" />
</shape>
谢谢!
I am trying to create a gradient drawable to depict a ratio of something. As a general example, lets say you were looking at a listview containing a fleet of cars. The background could be a fuel gauge - I don't want a smooth, wide transition. I want a very tight transition, and I want to be able to set where that transition takes place.
Here's what I'm staring with, but I'm not getting very far.
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#D2E3D3"
android:endColor="#E6E6E3"
android:angle="0"
/>
<corners android:radius="0dp" />
</shape>
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,您可以这样做:
然后将其设置为您的 backroundDrawable
Ok, here's how you can do it:
Then just set that as your backroundDrawable