3D Buttons

HKChua

Member
Licensed User
Longtime User
Hi Gurus,

Why is it that the buttons and spinners on the image posted on posting 2 look 3D and mine is flat and ugly?

Have I missed something?

Thanks.
 

fdx12345

Active Member
Licensed User
Longtime User
You can create 3d or really nice button by attaching a png image to the button. There are lots of free png button images around the net.
 
Upvote 0

dantheman

Member
Licensed User
Longtime User
Hi, now that that you've figured out how to use a PNG file for your button, could you tell me how please? Yours is the only pertinent thread from a search. Just adding an image file in the Designer doesn't let me have an option to choose it instead of the colours etc.
 
Upvote 0

PenguinHero

Member
Licensed User
Longtime User
Hi,

You just want to add an image to a button?
I'm not sure how to do that in the designer - I do all my stuff programatically.

In the code you can add a line like the following:

B4X:
btnPvP.SetBackgroundImage(LoadBitmap(File.DirAssets, "PvP2.png"))
Obviously you would replace my button name and image file name with your own, and you have to add the image to the project via the Files tab at the bottom-right of the IDE.

Someone must know how to do this in the designer, so hopefully you will get more answers. :)
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
In the Designer:
- add the image files you need using the Add Images button
- select the Button you want to add the images to
- set the Dawable property to StatelistDrawable
- select for each state BitmapDrawable
- select for each state the image

If you don't use Disabled state you can leave the default setting.

Best regards.
 

Attachments

  • ButtonImages1.jpg
    ButtonImages1.jpg
    51.8 KB · Views: 483
Upvote 0
Top