Change color of seekbar

rfsingh81

Member
Licensed User
Longtime User
Can someone please help me change the color of the seekbar as the slider moves left to right or vice versa.

I have Fan defined as a seekbar. I am using this statement
B4X:
   Fan.Color=Colors.Blue
in activit create, but it is not showing up as blue, it is still at its default yellow. Thanks
 

derez

Expert
Licensed User
Longtime User
You can't change the color of the standard seekbar. You'll have to design one yourself as a class or use one of already published seekbar classes.
 
Upvote 0

rfsingh81

Member
Licensed User
Longtime User
Thanks I will look into how to implement a ready made class.

Could you help me with this following problem:
B4X:
Sub Fan_ValueChanged(Value As Int,UserChanged As Boolean)
   If (UserChanged=True) Then
      AStream.Write(Value.GetBytes("UTF8"))
   End If
End Sub

What am I doing wrong above in getting the value of the seekbar Fan?
 
Last edited:
Upvote 0

derez

Expert
Licensed User
Longtime User
The GetByte is for string, and Value is int.
You can use this code, with byteconverter library:

B4X:
Dim intsarr(1) As Int
   Dim bycon As ByteConverter
   Dim buffer() As Byte
    intsarr(0) = Value
   buffer = bycon.IntsToBytes(intsarr)
   AStream.Write(buffer)

Or, change the int to string and send it, then on the other side change it back to int. (dim st as string = Value)
 
Last edited:
Upvote 0
Top