Android Question Set edittext base properties by code: corner radius...

demasi

Active Member
Licensed User
Longtime User
Hello,
Is there a way to set edittext base properties like corner radius, border color, border width by code?
Maybe using reflector or something like?
Thank you
 

demasi

Active Member
Licensed User
Longtime User
Thank you Mahares. This is only part of the solution. I still need to set border color and width.
I saw another post with a solution using java object to get the border witdth with jo.getfield("borderWidth"). I tried to change to setfield but somwthing was missing or wrong.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I still need to set border color and width
If you are looking for border and border color, the code referred to will do exactly that, without JavaObject or Reflector. Here is a more complete example with a picture of a button:
B4X:
Dim cd As ColorDrawable
    cd.Initialize2(Colors.Red,10dip,5dip,Colors.Cyan)
    btn.Background = cd
    btn.Text="I am a button"
 

Attachments

  • ButtonWithCornersAndBorder.png
    ButtonWithCornersAndBorder.png
    23.5 KB · Views: 226
Upvote 0

demasi

Active Member
Licensed User
Longtime User
Great! Thank you again Mahares. It worked. I never looked at this Initialize2.
A simple and working solution.
 
Upvote 0
Top