作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将箭头指向我的 Seekbar
(位于底部)。我曾经用这个圆圈作为拇指
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<gradient
android:startColor="#AAA"
android:endColor="#FFF"
android:angle="-90" />
<size
android:width="30dp"
android:height="30dp" />
<stroke
android:width="1dp"
android:color="#FFF" />
</shape>
但是现在我想使用箭头,如何绘制箭头或三角形?
这是我的Seekbar
<Seekbar
android:id="@+id/custom_seek_bar"
android:layout_width="match_parent"
android:thumb="@drawable/thumb_drawable"
android:progressDrawable="@android:color/transparent"
android:layout_height="wrap_content"/>
有什么办法可以改变它的颜色吗?
最佳答案
how do I paint an arror or a triangle?
您可以使用rotate
来做到这一点.
这是如何从底部制作三角形的示例
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="45"
android:pivotX="-35%"
android:pivotY="85%">
<shape>
<solid android:color="#0912ce" />
<size
android:width="20dp"
android:height="20dp" />
</shape>
</rotate>
它会像这样:
另外,如果你玩
android:fromDegrees="45"
android:pivotX="-35%"
android:pivotY="85%"
您可以将三角形移动到任何您想要的位置,例如移动到顶部:
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="-45"
android:pivotX="-85%"
android:pivotY="-10%">
<shape>
<solid android:color="#0912ce" />
<size
android:width="20dp"
android:height="20dp" />
</shape>
</rotate>
它看起来像这样:
然后您就可以随意更改 android:thumb
来自您的 SeekBar
的属性并将其更改为您的新拇指。
And is any way to change the color of it?
您必须更改 <solid android:color="#0912ce" />
随心所欲。
关于java - 如何在 Seekbar 上放置箭头作为选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50861837/
我是一名优秀的程序员,十分优秀!