镜像(翻转)视图/进度栏 [英] Mirror (flip) a View / ProgressBar
问题描述
我有一个自定义的圆形进度条,用于在时钟上设置秒计数器,我想对其进行翻转,以使时钟沿逆时针方向计数.
I have a custom built circular progress bar used for a seconds counter on a clock, which I'd like to flip, so that the clock is counting counter-clockwise.
在这里搜索解决方案,我发现了这一点:
Searching here for a solution, I found this:
这显然适用于水平进度条,但是我不能简单地将其旋转180度,因为那样只会将时钟移动180度,并且仍然会沿顺时针方向滴答作响.
Which obviously works for a horizontal progress bar, but I can't simply rotate it 180 degrees, since that will just move the clock 180 degrees and it will still be ticking clockwise.
还有其他方法可以镜像ProgressBar或任何视图吗?
Is there any other way to mirror a ProgressBar, or any View?
刚刚找到了"android:rotationY"和程序上的等效项,但是理想情况下,该值应为2.2及更高版本.
Just found "android:rotationY" and the programmatic equivalent, but this ideally needs to be for 2.2 and above..
推荐答案
我能够仅使用XML中的属性 scaleX
来翻转 ProgressBar
:
I was able to flip ProgressBar
simply with attribute scaleX
in XML:
android:scaleX="-1"
这也适用于其他 View
.
这篇关于镜像(翻转)视图/进度栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!