i want seekbar in which there should be image and text upon the thumb and while scrolling image and text should be stay upon thumb of seekbar in Android please help me.
Asked
Active
Viewed 463 times
1 Answers
0
You can define a new thumb as a Drawable. You can transform any View in a Drawable.
TextView yourView = new TextView(this);
yourView.setText("text");
yourView.setBackgroundResource(R.drawable.background_resource);
// taken from the other ticket
Bitmap snapshot = null;
Drawable drawable = null;
yourView.setDrawingCacheEnabled(true);
yourView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW); //Quality of the snpashot
try {
snapshot = Bitmap.createBitmap(yourView.getDrawingCache(), sizes and stuff); // You can tell how to crop the snapshot and whatever in this method
drawable = new BitmapDrawable(snapshot)
} finally {
yourView.setDrawingCacheEnabled(false);
}
mySeekBar.setThumb(drawable);
I didn't try this code, but the solution should go into this direction.
Then, thumb can be created statically, as a Drawable xml, for example layering different images. Anyway, if you want it to contain a dynamic content you should create it dynamically, so periodically update it. Create a layout with a textview and then use this: Create drawable from layout
-
thanks for your reply...but i m getting it if possible then plz give me whole class – shripal Oct 22 '13 at 09:11