0

I am trying to make a seekbar with only nine-patch images. One nine patch is the background. I want to remove the thumb and want the other nine-patch to expand when I slide towards the right. Presently the thumb always appears.

I have tried the method given in this answer: Android seekbar set custom style using nine-patch images

But this also gives an extra thumb. And on sliding right the nine patch appears complete only when I am done sliding till the extreme right. Here is my nine patch image and I want the arm to increase as I go towards the right on the seekbar.

Any help?

P.S. by thumb I mean the seekbar thumb and not the thumb in the image.

Need to make an image like this

Community
  • 1
  • 1
Ananth
  • 63
  • 9
  • tried `setThumb(null)`? – pskink Jan 02 '16 at 09:54
  • Yes it did work. But two issues still remain. 1) My 9-patch is coming below my seekbar for some reason. 2) The thumb part of my 9-patch appears when i reach the extreme right. Whereas I want it to be there since beginning and just the arm to increase. Any help? – Ananth Jan 02 '16 at 10:14
  • so it seems you have to draw your "thumb from your image" by hand, see how to extend `Drawable` [here](http://stackoverflow.com/a/30873744/2252830) – pskink Jan 02 '16 at 10:53
  • Drawing the thumb. Doesn't seem like a solution. I am looking for something like this. I feel it has to be done using 9-patch only. http://postimg.org/image/p6wjoti21/ – Ananth Jan 02 '16 at 11:25
  • in theory you can do it by: ` ` but the results are, hmm, not so good – pskink Jan 02 '16 at 11:46
  • I basically need to replace the thumb with a 9-patch. If you can suggest some way for that, then that'd be great. Thanks a lot anyways. – Ananth Jan 02 '16 at 11:57
  • i already did it: have you tried my previous comment? – pskink Jan 02 '16 at 11:57
  • Didn't understand where to place it. Here is my seekbar xml, `` – Ananth Jan 02 '16 at 12:03
  • read [this](http://developer.android.com/guide/topics/resources/drawable-resource.html) – pskink Jan 02 '16 at 12:04
  • And here is my search_progress_clip. ` ` – Ananth Jan 02 '16 at 12:05
  • i sent you a progress drawable, just use it – pskink Jan 02 '16 at 12:06
  • That worked sir, Brilliant. But just one last problem. This is my seekbar `` and the progress Drawable is what you sent. The background line disappears now. How do I get a background line or image? – Ananth Jan 02 '16 at 12:23
  • use a `` then – pskink Jan 02 '16 at 12:24
  • I did this. ` `. But my background also fills the whole height while I want it to be in the middle of my progress. – Ananth Jan 02 '16 at 12:31
  • so your background needs to be "scaled" by a `` drawable, so place it inside `` – pskink Jan 02 '16 at 13:24
  • Did this. ` `. Any % shows no background. What to do? – Ananth Jan 04 '16 at 05:27
  • use one and inside place background and thumb – pskink Jan 04 '16 at 08:54
  • But a scale can't have two drawables? – Ananth Jan 04 '16 at 09:06
  • sure `` cannot have two `Drawable`s, that's why i suggested to read [this](http://developer.android.com/guide/topics/resources/drawable-resource.html) – pskink Jan 04 '16 at 09:11
  • so it seems you have to draw your "thumb from your image" by hand. This is what you said. So the arm can still be a nine-patch? And I use the custom drawable as the seekbar thumb. Is that what you're suggesting? – Ananth Jan 04 '16 at 09:51

0 Answers0