Android Question How to Center DilatingDotsProgressbar

mcqueccu

Well-Known Member
Licensed User
Longtime User
Find Attached Sample Project. I needed the dotsprogress to be in center even if i stretch its width to 100%
 

Attachments

  • dots.zip
    11.2 KB · Views: 211
  • dots image.png
    dots image.png
    20.8 KB · Views: 223
Upvote 0

klaus

Expert
Licensed User
Longtime User
You can calculate the Left property like this:
B4X:
Private Width As Int
Width = (DotRadius * 2 + DotsSpacing) * NumberOfDots - DotsSpacing
dots.Left = (100%x - Width) / 2
Unfortunately the Width property returned by the library is the width from the Designer and not the real width.
And DotRadius, DotsSpacing and NumberOfDots are write only so you need to enter your values or define variables for them.
You should use dip values for DotRadius and DotsSpacing and not pixel values!
 
Last edited:
Upvote 0
Top