Android Question Rotary knob post!

Discussion in 'Android Questions' started by Beja, Jul 31, 2018.

  1. Beja

    Beja Expert Licensed User

    Hello all,
    After searching for a post about a rotary knob that has steps (not continuous).. I finally gave up
    the switch jumps from one value to another like that of the washing machine. any help appreciated.

  2. derez

    derez Expert Licensed User

    I use these two subs in a clock application to rotate the clock's hands, it is the same as what you want with the change of starting angle and angle difference for each step:
    Sub setRotation(v As View, Angle As Float)
    Dim jo = v As JavaObject
    "setRotation"Array As Object(Angle))
    End Sub

    Sub drawhand(lbl As Label, index As Double)
    Dim q As Double = 270 + 6 * index
    End Sub
    Add a click event to make the knob rotate to the next step.
    Beja likes this.
  3. Beja

    Beja Expert Licensed User

    Thanks derez
    Some time ago I read a post with realistic graphical knob.. but now can't find it.. will try your solution.
  4. DonManfred

    DonManfred Expert Licensed User

  5. derez

    derez Expert Licensed User

    How much realistic depends on the graphics of the image you put on the central view.
  6. Star-Dust

    Star-Dust Expert Licensed User

  7. Beja

    Beja Expert Licensed User

  8. LucaMs

    LucaMs Expert Licensed User

    Beja likes this.
  9. Beja

    Beja Expert Licensed User

  10. klaus

    klaus Expert Licensed User

    You may have a look at this project, I made it as a XUI challenge.
    It is a XUI B4X CustomView.
    It needs some improvements.
    At the moment it doesn't work yet with B4i, will be fixed.
    You can turn the button, and it snaps onto the nearest value.
    A click in the middle selects the next value, a LonkClick in the middle selects the prevous value.


    EDIT: 2018.08.11
    Removed the zip file.
    A new version is HERE.
    Last edited: Aug 11, 2018
    Johan Hormaza, asales, Erel and 3 others like this.
  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