B4A Library Flat Button

Johan Schoeman

Licensed User
This library is based on the project that is posted here. See attached project and screenshot. Library files are in the /files folder of the project.

Other than the parameters that are set in the project you can also set the Left, Top, Width, and Height of the customview buttons.

Buttons have a kind of eye-blinking effect when clicked. You have to download and install it to appreciate what the buttons are doing.

CustomView1.Left = 0%x
CustomView1.Top = 0%y
CustomView1.Width = 15%x
CustomView1.Height = 15%y


Last edited:


Well-Known Member
Licensed User
Tried it with gradient background, got an error.

Here are my codes :
    Dim bd As GradientDrawable
    Dim cl(2) As Int
    cl(0) = Colors.Black
    cl(1) = Colors.RGB(234,24,24)

    CustomView4.ButtonColor = Colors.ARGB(150,255,255,255)
    CustomView4.CornerRadius = 20dip
    CustomView4.ShadowColor = Colors.ARGB(100,255,255,255)
    CustomView4.ShadowHeight = 10dip
    CustomView4.Height = 20%y
    CustomView4.ShadowEnabled = True
    CustomView4.ImageBitmap = LoadBitmap(File.DirAssets,"google+48.png")
    CustomView4.ButtonText = "Button 4"
    CustomView4.ButtonTextSize = 25
    CustomView4.ButtonTextColor = Colors.Green
    CustomView4.Width = 150dip
    CustomView4.Background = bd

Johan Schoeman

Licensed User
It is actually very simple to re-create these "flat buttons" with B4A code only (including GradientDrawable). See attached project. You can tweak the buttons to your hearts wish without having to rely on the capability of any library whatsoever.

Edit: See V2. Either text or image in the button


Last edited: