反向搜寻栏(从右到左)颜色 [英] Reverse seekbar (Right to left) colour

查看:70
本文介绍了反向搜寻栏(从右到左)颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试实现类似于您用于接听或拒绝通话的搜索栏。

I've been trying to implement a seek bar similar to the ones you use to accept or decline a call.

对于接受呼叫,我设置了sbLeft.setProgress(0),对于拒绝呼叫,我设置了sbRight.setProgress(15),其中setMax = 15 bot都在搜索小节。这给了我一半的期望结果。

For call accept I set sbLeft.setProgress(0) and for call decline I set sbRight.setProgress(15), with setMax=15 bot both seek bars. This gives me half of the desired result.

我面临的问题是颜色。

我拖动左搜寻栏以接听电话我需要覆盖被拖动部分的绿色。为此,我使用以下代码(给我想要的结果):

As I drag the left seekbar to accept a call I need a green colour that covers the dragged part. For that I use the following code (giving me the desired result):

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 


<item android:id="@android:id/background"> 
    <shape> 
        <corners android:radius="5dip" /> 


        <solid android:color="@android:color/transparent"/>
    </shape> 
</item> 

<item android:id="@android:id/secondaryProgress"> 
    <clip> 
        <shape> 
            <corners android:radius="5dip" /> 
          <!--   
            <gradient 
                android:startColor="#41a317" 
                android:centerColor="#4cc417" 
                android:centerY="0.75" 
                android:endColor="#347c17" 
                android:angle="270"  />-->
                <solid android:color="@android:color/transparent"/>
        </shape>
    </clip> 
</item> 

<item android:id="@android:id/progress"> 
    <clip> 
        <shape> 
            <corners android:radius="5dip" /> 

            <gradient 
                android:startColor="#41a317" 
                android:centerColor="#4cc417" 
                android:centerY="0.75" 
                android:endColor="#347c17" 
                android:angle="270"  />

        </shape> 
    </clip> 
</item> 

</layer-list> 

但是,即使我切换了透明颜色标签和渐变标签,也无法解决通话中断的问题

However this doesnt work for the call decline, even though I switch the transparent colour tags and the gradient tags.

PS:我知道我的问题可能有点令人困惑。希望我能尽我最大的努力来解释我的问题。

PS: I realize my question might be a little confusing. Hope Ive tried my best to explain my problem.

推荐答案

在这里您可以找到用于自定义SeekBar以使其成为Rigth的代码。向左。

Android SeekBar水平翻转
我希望它可以帮助您想知道您在寻找什么。

Here you can find code for customizing a SeekBar in order to make it Rigth to Left.
Android SeekBar Flipped Horizontally
I hope that it can help u to wonder what you are looking for.

这篇关于反向搜寻栏(从右到左)颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆