Android Question CircularProgressBar align center problem

Discussion in 'Android Questions' started by Brandsum, Jan 22, 2019.

Tags:
  1. Brandsum

    Brandsum Active Member Licensed User

    There is a problem in this XUI custom view. When I set HorizontalAnchor and VerticalAnchor to both sides to place it in the center in designer window, I'm getting this error while loading the layout file.

    Code:
    *** Service (starter) Create ***
    ** 
    Service (starter) Start **
    ** 
    Activity (main) Create, isFirst = true **
    Panel size is unknown. Layout may not be loaded correctly.
    Error occurred on line: 
    39 (CircularProgressBar)
    java.lang.IllegalArgumentException: width 
    and height must be > 0
        at android.graphics.Bitmap.createBitmap(
    Bitmap.java:1033)
        at android.graphics.Bitmap.createBitmap(
    Bitmap.java:1000)
        at android.graphics.Bitmap.createBitmap(
    Bitmap.java:950)
        at android.graphics.Bitmap.createBitmap(
    Bitmap.java:911)
        .....
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Sounds like you are not using anchors correctly. The result is that the control size is negative.

    You should never use anchors set to BOTH on small controls in the center. Watch this video tutorial: https://www.b4x.com/etp.html?vimeography_gallery=1&vimeography_video=254439386
     
  3. Brandsum

    Brandsum Active Member Licensed User

    So, how can I place the circular bar in the center of a panel inside viewpager.
    Could you check this dummy project and correct that?
     

    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice