Android Question A simple button

LucaMs

Expert
Licensed User
Longtime User
A simple button added by code certanly has its default properties.

What is its default color? More exactly, what type is it. [P.S.: StateListDrawable]

If I add a button this way and then I reset its color, it appears higher.

Is this due to the padding? Or to the corner radius?
 

Attachments

  • lm some test.zip
    7.4 KB · Views: 160
Last edited:

LucaMs

Expert
Licensed User
Longtime User
I am really surprised.

Has no one ever allowed the user to save the color of a button in the preferences?

Probably for the button images are most used.

Certainly it is strange that no one has noticed this problem before.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Buttons are made of nine patch images. When you set the Button's Color property you remove the existing background and set a new ColorDrawable. Unlike the image which has some padding the ColorDrawable doesn't have any padding.


I think you agree that you expected a different behavior, which is the same that is obtained using the Designer.

So should I get nine patch image and restore it? Or worse, get it and then recolor it!

Maybe you can make this change in the next version of B4A.



Thanks, Erel
 
Upvote 0
Top