1

I Have a horizontal progress bar in a nested recyclerView. The situation is I want to start the animation of the determinant progress bar when it's 5 dp above the bottom and complete its progress when it reaches the middle of the screen. Just imagine you have a while scrolling the recyclerView. As soon as it appears from the bottom while scrolling the recyclerVeiw it starts increasing its progress and complete its progress when it reaches to the middle of the screen. I am attaching a demo Video of the circular Progressbar how it should be done. Any suggestion will be appreciated.Link of sample

I have tried this and some other samples too

    int[] location = new int[2];
    holder.progressbar_text.getLocationOnScreen(location);
    int menuViewX = location[0];
    int menuViewY = location[1];

I have tried to calculate the progress bar location. As you can see I am getting the location of the progressbar vertically which is menuViewY. Here are the solutions that I have tried link1. link2 In the above two questions I have tried all the suggested solutions.

    Log.i("bound", "Absolute Position" + menuViewY);

   // Progresbar animations
   holder.progressbar_text.enableAnimation();
   holder.progressbar_text.setScrollBarFadeDuration(9000);
   holder.progressbar_text.setAnimationSpeedScale(5);
   holder.progressbar_text.setProgress(40);
   holder.progressbar_text.setSecondaryProgress(70);
Irfan Yaqub
  • 402
  • 4
  • 14
  • 1
    Ok, it's clear what you want to do, you want to tie a view's property (in this case a ProgressBar.progress) to a property that changes over time, based on the position of said view in the screen in relation to the edges (top and bottom). Now, your next step is to tell us what you've tried and what happened (what didn't work, since if it would have worked, you wouldn't be asking a question here). You say "I have tried this and other samples too" but we don't know what other samples you've tried, or *what problems you have*. – Martin Marconcini Sep 27 '21 at 07:24
  • @MartinMarconcini I have updated the question. please check it. – Irfan Yaqub Sep 28 '21 at 05:14

0 Answers0