Creating a custom search engine (without XML)

I'm currently trying to create a custom Seekbar without using xml, as the background images and progress bar need to be changed. This is what I have at the moment:

Drawable drawable = new BitmapDrawable(appState.images.get(Integer.parseInt(image))); this.setBackgroundDrawable(drawable); Drawable drawable2 = new BitmapDrawable(appState.images.get(Integer.parseInt(image_a))); this.setProgressDrawable(drawable2); this.setProgress(0); 

But progressGrawable just sets to the full size of the Seekbar, and when I move my thumb from side to side, nothing happens. Does anyone have any ideas as I'm completely at a dead end.

+1
source share
1 answer

So this previous answer does the trick for you:

Resize the search program programmatically, but cannot increase the size of the thumb than the panel

From the initial scam:

In the end, I use this code:

 public void setSeekBarImages(){ Drawable drawable = new BitmapDrawable(appState.images.get(Integer.parseInt(image_a))); ClipDrawable clip = new ClipDrawable(drawable, Gravity.LEFT,ClipDrawable.HORIZONTAL); Drawable drawable2 = new BitmapDrawable(appState.images.get(Integer.parseInt(image))); InsetDrawable d1= new InsetDrawable(drawable2,5,5,5,5); //the padding u want to use setThumb(null); LayerDrawable mylayer = new LayerDrawable(new Drawable[]{d1,clip}); setProgressDrawable(mylayer); setProgress(0); } 
+4
source

Source: https://habr.com/ru/post/1494907/


All Articles