B4A Library Flat Button

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


  • FlatButton.png
    33.6 KB · Views: 1,166
  • FlatButton.zip
    105.7 KB · Views: 521
Last edited:


Well-Known Member
Licensed User
Longtime 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
Longtime 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


  • FlatButtonWithb4aCode.zip
    12.7 KB · Views: 304
  • FlatButtonWithb4aCodeV2.zip
    23.1 KB · Views: 305
Last edited:

Johan Schoeman

Licensed User
Longtime User
Have added some variants to the buttons - click them to see what happens. fiddleAround library files in the /files folder.


  • FlatButtonWithb4aCodeV3.zip
    83.8 KB · Views: 304