B4A Library [B4X] [XUI] Gauge View

Status
Not open for further replies.
This custom view class is compatible with B4A, B4J and B4i.

gauge.gif


A nice and simple gauge.
You can easily customize it as needed.
It uses the Crystal font: http://www.fontspace.com/allen-r-walden/crystal
There are two types of gauges: half circle and full circle.

Usage instructions:
- Add the class and the font file to your project.
- Add it with the designer and configure it:

SS-2017-12-21_17.37.32.png


- Set the colored ranges:
B4X:
Gauge1.SetRanges(Array(Gauge1.CreateRange(0, 40, xui.Color_Green), _
   Gauge1.CreateRange(40, 80, xui.Color_Yellow), _
   Gauge1.CreateRange(80, 100, xui.Color_Red)))
- In B4i the font file should be copied to Files\Special and the following line should be added to the main module:
B4X:
#AppFont: Crysta.ttf
- Animations can be a bit jumpy in debug mode. Should be smooth in release mode.

A B4A project is attached.

See post #10 for adding numbers to the ticks:

SS-2017-12-24_17.45.46.png
 

Attachments

  • Gauges.zip
    19.4 KB · Views: 2,385
Last edited:

voxel

Member
Licensed User
Hello,
is it possible to hide the gauge? I can't find any parameter visible = false
Thanks for your help
 

voxel

Member
Licensed User
Make mBase as public variable. This is a convention used in most newer custom views.
B4X:
Gauge1.mBase.Visible = False

I'm a newbie, adding this line: Public mBase As B4XView, it doesn't work
Thank
 

voxel

Member
Licensed User
View attachment 78322

Thanks Erel for your rapid answer, I forgotten to set the Alpha to zero... Gauge works fine !!

Hello,
I have the same problem and I don't have the Alpha Level Parameter. My application has a blue background, which distorts the colors. Is there a parameter to have the real colors in the gauge? Thank you
 
Status
Not open for further replies.
Top