Android Question Wheel in CustomView not working properly

william_chen

Member
Licensed User
Longtime User
I try to build a custom view using the following Wheel.
https://www.b4x.com/android/forum/threads/wheel-by-b4a-class.18855/

However, the wheel doesn't work properly in the custom view:
(1) The selected item does not rest on the right position between the two red lines.
(2) When I scroll to the last item at bottom, it will not rotate to the first item at top, it will simply stop at bottom.

However, if I scroll to the first item at top, it does rotate properly to the last item at bottom.
The above two problems may be caused by same reason.
When I debug into the Wheel class module, I find the position var will not pass certain limit in the sv_ScrollChanged() event.

I attached a screen shot to show the problem.


B4X:
Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map)
    mBase = Base
    CallSubDelayed2(Me,"LoadLayout",Props)
End Sub

Sub LoadLayout(Props As Map)
    Dim Holder As Panel
    Holder.Initialize("")
    Dim Act As Activity=Props.Get("activity")
    Act.AddView(Holder,20dip,20dip,350dip,350dip)

    Holder.LoadLayout("test")
    Dim Hours(2) As String=Array As String("0","23")
    Wheel1.SetObject(Hours)
 
    Wheel1.SetAppearance(Colors.Yellow,Colors.Blue,24,Gravity.CENTER)
 
End Sub
 

Attachments

  • Wheel_in_CustomView.png
    Wheel_in_CustomView.png
    8 KB · Views: 199
Top