Android - How to mark timestamps on a SeekBar

I will be working on an application that records button presses where I can play this session on a SeekBar. Each event will be marked in time from the value of the chronometer. When playing on each of these recorded events, I will play sound. This part should not be a problem.

Now I would like to find out how I can mark timestamps on the SeekBar by drawing red bars in the positions where each event occurred. I would like the red bars to appear before playback.

Since I have not yet run this application, I do not have the code now.

+5
source share
2 answers

If I were to this, I would use the following procedures:

  • Take the search view handle in my java code and keep the width.
  • Width is a timeline starting at 0 until the user no longer acts on the view. Lets call this stop value T (seconds).
  • When recording is complete, divide the width by seconds based on T.
  • Each timestamp will be displayed at the x coordinate based on # 3. Draw a red vertical line centered on this image at x. If you draw it on top, it can ruin the interaction with the search server.

I know this is not code, but hopefully it will give you a good idea on how to solve this problem.

+2
source

You cannot mark anything in the search bar. Therefore, do not use the search bar. Just use simple pixels to draw as a line with match_parent width and 2dp height. Place a small circular image as a search bar. Then mark the pixels wherever you want the marking.

Look at the concept

................... ABOUT.............................. ..............................

This is your search. Mark a specific point for you dynamically.

0
source

All Articles