【问题标题】:Reverse seekbar (Right to left) colour反向搜索栏(从右到左)颜色
【发布时间】:2013-04-26 08:07:43
【问题描述】:

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

对于呼叫接受,我设置了 sbLeft.setProgress(0),对于呼叫拒绝,我设置了 sbRight.setProgress(15),setMax=15 机器人都搜索栏。这给了我一半的预期结果。

我面临的问题是颜色。

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

<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> 

但是这对于呼叫拒绝不起作用,即使我切换了透明颜色标签和渐变标签。

PS:我意识到我的问题可能有点令人困惑。希望我已尽力解释我的问题。

【问题讨论】:

  • 你找到解决方案了吗?

标签: android colors reverse seekbar


【解决方案1】:

您可以在此处找到自定义 SeekBar 以使其从右向左的代码。
Android SeekBar Flipped Horizontally
我希望它可以帮助你想知道你在寻找什么。

【讨论】:

  • 谢谢。它不是我现在正在寻找的东西。稍后会检查代码并告诉你它是如何工作的。
猜你喜欢
  • 2021-05-04
  • 1970-01-01
  • 2017-02-05
  • 1970-01-01
  • 2012-12-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-06-29
相关资源
最近更新 更多