2014-01-18 22 views
1

我需要搜索欄像this搜索條:如何自定義與stepvalues

seekbar
我不知道如何設置stepvalues的搜索條,如果有人已經定製搜索條一樣好心幫我

+0

我需要在seekbar以下設置stepval,就像我的共享圖像 –

+0

我想他想要相同的設計,對嗎? –

+0

@mohammedmomn no先生,我需要設置該步驟值(10,20,30) 像這樣[點擊這裏](https://www.dropbox.com/s/e2viidnb6pbni99/Untitled1.png) –

回答

0

您可以使用,

seekBar.setProgress(0); // change this to starting point... 
seekBar.incrementProgressBy(10); 
seekBar.setMax(200); // change this to whereever you what to stop.. 

要顯示搜索條下面一個TextView,

既然你知道incrementby和最大值,可以爲循環運行..並獲得seek.getProgress()第一次,將其轉換爲字符串,然後繼續追加incrementby爲String ....

+0

我需要設置下面搜索條stepvalues,像在我的共享圖像 (10 20 30 40) –

+0

yes,incrementProgressBy(10);將這樣做..所以改變setmax(200)到你的終點.. – thestar

+0

對不起@Sunny它不顯示stepvalues在我的輸出它顯示像這樣 [點擊這裏(https://www.dropbox.com/s /zrkkzc4qky940j0/Untitled.png) 但我需要[clickhere](https://www.dropbox.com/s/e2viidnb6pbni99/Untitled1.png) –

0

我會建議三種方法。首先使用comboSeekBar來完成你所需要的。

請參閱thisthisLibrary link

secondly你可以簡單地使用incrementProgressBy作爲this Example這樣做在Seekbar中改變步驟。或者你可以setMax到7。併爲每個步驟multiply the progress與10作爲this Example呢。

SeekBar seekBar = (SeekBar)layout.findViewById(R.id.seekbar); 
seekBar.setProgress(0); 
seekBar.incrementProgressBy(10); 
seekBar.setMax(200);