2012-03-22 4 views
-1

seekbar를 사용하여 현재 값을 표시하고 원하는 값을 조정하고 싶습니다. 나는 thumb (Progress)과 bar (SecondaryProgress)로 현재 값을 통해 원하는 값을 변경할 수 있었다.Seekbar - SecondaryProgress와 Progress의 연결을 해제하려면 어떻게해야합니까?

SecondaryProgress가 Progress보다 낮아지면 SecondaryProgress의 값이 실제로 낮아 지거나 심지어 디버거에서 0으로 설정 되어도 Bar는 Progress와 동일한 값을 표시합니다.

이 어떻게 보일지 :

SecondaryProgress < Progress <-- doesnt work, shows: 
(==== O )        (=======O ) 

SecondaryProgress == Progress <-- works 
(=======O ) 

SecondaryProgress > Progress <-- works 
(=======O== ) 

내가 그것을 조정할 수있는 설정이 있나요? 또는 탐색 바를 사용자 정의해야합니까? 그렇다면 어디에서 시작해야합니까? 나를 위해이 나던

+0

왜 나는 downvote를 얻었습니까? – Martze

답변

1

가 조금 늦게 될 수도 도와 ... 내가 레이아웃에서 할 수있는 일처럼

감사를 보이지만, 나는 그 문제에 볼 수있는 가장 좋은 방법은 검색 막대를 사용자 정의 할 수 있으며, seekBar의 높이의 일부만 사용하는 2 차 진행 드로어 블을 사용합니다.

예를 들어 2 차 진행을 위해 추첨 하단을 사용하고 진행하기 위해 10dip을 맨 위에 놓고 싶다고 가정 해 보겠습니다. 우리는 우리의 SeekBar를 위해 진행 당김으로 아래의 코드를 사용할 수 있습니다 주요 팁이 그 위에 그려진 있도록 레이어 목록에서 진행 당김 후 보조 진행 당김을 넣어하는 것입니다, 항상 볼 수

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:id="@android:id/background"> 
    <shape> 
     <corners android:radius="5dip" /> 
     <gradient 
     android:startColor="#ffffffff" 
     android:centerColor="#ffdddddd" 
     android:centerY="0.50" 
     android:endColor="#ffffffff" 
     android:angle="270" /> 
    </shape> 
    </item> 
    <item android:id="@android:id/progress"> 
    <clip> 
     <shape> 
     <corners android:radius="5dip" /> 
     <gradient 
      android:startColor="#ff0088eb" 
      android:endColor="#ff0068e7" 
      android:angle="90" /> 
     </shape> 
    </clip> 
    </item> 
<item android:id="@android:id/secondaryProgress"> 
    <clip> 
     <inset 
      android:insetTop="10dp"> 
      <shape> 
      <corners android:bottomLeftRadius="5dip" 
       android:bottomRightRadius="5dip" /> 
      <gradient 
       android:startColor="#ff00c8fb" 
       android:endColor="#ff00a8f7" 
       android:angle="90" /> 
      </shape> 
     </inset> 
    </clip> 
    </item> 
</layer-list> 

전체 SeekBar 높이를 차지하지 않도록 인세 트를 사용하십시오. 당신의 예에서

, 당신은이 같은 결과를 얻을 수 있습니다 :

SecondaryProgress < 진행 (==== --- O        )

SecondaryProgress == 진행 (== ===== O        )

SecondaryProgress> 진행 (======= O--        

관련 문제