2013-05-08 78 views
0

我要實現這一點:搜索欄發行的Android

在這個時間我在

我的問題這點我想刪除了「montant demande」和搜索條之間的空間。這不是由於頂部邊距或填充,因爲我沒有設置任何頂部/底部邊距或填充。

其次。如何在seekbar thumb下面設置欄,以便拇指可以在豎欄上移動。

對於seekbar,我使用自定義的xml背景。代碼如下所示。

<?xml version="1.0" encoding="utf-8"?> 
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:id="@android:id/background"> 
     <shape> 
      <gradient 
      android:startColor="#ffffffff" 
       android:centerColor="#ffdddddd" 
       android:centerY="0.20" 
       android:endColor="#ffffffff" 
       android:angle="270"/> 

      <padding android:left="1dp" 
      android:top="1dp" 
      android:right="1dp" 
      android:bottom="1dp"/> 
     <corners android:radius="1dp"/> 
    </shape> 
</item> 



<item android:id="@android:id/progress"> 
    <clip> 
     <shape> 
      <gradient 
        android:startColor="#ff0e75af" 
        android:endColor="#ff1997e1" 
        android:angle="90" /> 
      <padding android:left="1dp" 
       android:top="1dp" 
       android:right="1dp" 
       android:bottom="1dp"/> 
      <corners android:radius="1dp"/> 
     </shape> 
    </clip> 
    </item> 
</layer-list> 

在我的main.xml中,seekbar具有以下屬性。

<SeekBar 
      android:id="@+id/seekvalue" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="@dimen/eight_dp" 
      android:layout_marginRight="@dimen/eight_dp" 
      android:background="@color/fulll_transparent" 
      android:indeterminate="false" 
      android:max="48500" 
      android:maxHeight="12dip" 
      android:minHeight="5dp" 
      android:paddingLeft="@dimen/twenty_sp" 
      android:paddingRight="@dimen/ten_dp" 
      android:progressDrawable="@drawable/progressbar" 
      android:thumb="@drawable/slider" 
      android:thumbOffset="-1px" /> 

回答

0

您需要使用透明IMG和不應該有在img.I任何填充覺得你IMG角落是透明的,因此它佔用空間刪除that.Basically你需要用五年IMG

1.seekbartotal background 
2.seekbar played background 
3.seekbar buffered backgroung 
4.seekbar thumb and finally 
5.seekbar thumb focus 

進一步瞭解this希望這會幫助你很多。

+0

你是對的朋友拇指是負責的空間 – Dimitri 2013-05-08 06:24:04

+0

是的好如果這有助於你出來接受這個,所以其他將利用這個答案 – Dilip 2013-05-08 06:30:58

+0

我還沒有找到解決方案,但Dipu。基於你說的,我需要使用一個進度條和一個seekbar,在seekbar中設置進度高度爲0或透明,然後移動拇指並設置進度條上的進度是嗎? – Dimitri 2013-05-08 06:34:55

1

將maxHeight和minHeight值設置爲相同,並根據拇指在進度線上的位置增加或減少兩個值。

+0

好吧,我會嘗試它,讓你知道x) – Dimitri 2013-05-08 06:18:04

+0

只是嘗試但遺憾的是它改變了進度條。空間仍然存在 – Dimitri 2013-05-08 06:19:54

+0

是否解決你的第二個問題。 – 2013-05-08 06:27:38