2011-06-27 7 views
21

私は奇妙な問題に遭遇しました。私はカスタムサムとシークバーを実装しました。また、HTC Desireでアプリケーションを実行したとき、すべて正常に動作します。しかし、Samsung Galaxy、親指が切り取られます!Androidのシークバーがサムを切り取った

Desire seekbar

サムスンギャラクシー:

Galaxy seekbar

私はどのthoughts..tnx

に感謝でしょう。ここ

はスクリーンショットが..

欲望です

myprogress.xml:

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

<item android:id="@android:id/background"> 
    <shape> 
     <corners 
      android:radius="10dp" /> 
     <gradient 
       android:startColor="@color/gray" 
       android:centerColor="@color/gray" 
       android:centerY="0.75" 
       android:endColor="@color/gray" 
       android:angle="270" 
     /> 
    </shape> 
</item> 

<item android:id="@android:id/secondaryProgress"> 
    <clip> 
     <shape> 
     <corners 
      android:radius="10dp" /> 
      <gradient 
        android:startColor="@color/white" 
        android:centerColor="@color/white" 
        android:centerY="0.75" 
        android:endColor="@color/white" 
        android:angle="270" 
      /> 
     </shape> 
    </clip> 
</item> 

<item android:id="@android:id/progress"> 
    <clip> 
     <shape> 
     <corners 
      android:radius="10dp" /> 
      <gradient 
       android:startColor="#FFA500" 
       android:centerColor="@color/yellow" 
       android:centerY="0.75" 
       android:endColor="@color/yellow" 
       android:angle="270" 
      /> 
     </shape> 
    </clip> 
</item> 

スタイル:

<style name="mySeekBar"> 
    <item name="android:indeterminateOnly">false</item> 
    <item name="android:progressDrawable">@drawable/myprogress</item> 
    <item name="android:indeterminateDrawable">@android:drawable/progress_horizontal</item> 
    <item name="android:minHeight">10dip</item> 
    <item name="android:maxHeight">10dip</item> 
    <item name="android:thumb">@drawable/thumb</item> 
    <item name="android:thumbOffset">4dp</item> 
    <item name="android:focusable">true</item> 

シークバーのXML:

<SeekBar android:id="@+id/player_seek_horizontal" 
     android:layout_gravity="center_vertical" 
     android:max="100" 
     android:layout_marginLeft="50dp" 
     android:layout_width="180dp" 
     android:thumb="@drawable/thumb" 
     android:layout_height="wrap_content" 
     style="@style/mySeekBar" 
     android:background="@drawable/background_transparent_rounded" 
     android:paddingRight="4dp" android:paddingLeft="4dp"/> 
+0

関連するXMLファイルとソースファイルを投稿してください。 – sparkymat

+0

これを解決できましたか?私はデフォルトのシークバーと同じ問題に直面しています。 'padding'と' thumbOffset'を使うと、異なるAPIバージョンで動作が異なります。 – faizal

答えて

32

は、android:paddingRightandroid:paddingLeftを調整します所望の結果を得るためにSeekBarの特性をandroid:thumbOffsetにしてください。

左右のパディングは、親指の幅の半分にする必要があります。

+0

これらのxmlを見れば、私はすでにそれを試したことが分かります。私は1つのデバイスに対して正しく設定すれば、別のものには悪いことが判明します –

+2

@TomislavNovoselec、右と左のパディングは親指の幅の半分になります。それはうまくいくはずです。 – JRC

+1

親指の幅をどのように見つけたり設定したりしますか? – faizal

7
<SeekBar 
    ... 
    android:paddingLeft="5dp" 
    android:paddingRight="5dp" 
    android:thumbOffset="0px" /> 

私のために働いた。

関連する問題