How to make an x amount of buttons programmitacally

jhill16jhill16 USMember ✭✭

I am trying to make a button for item in a list but the list is always changing and I am unaware on how to do it. I also will need to know how to edit the margins/padding and change the color of the button to a custom color that we have the RGB values of
Any help is greatly appreciated


  • ajoharajohar INMember ✭✭

    You can add buttons programmatically using:

    var myLayout = FindViewById(Resource.Id.myLayout);
    Button btn = new Button();
    btn.Text = "Your Text";


    That's basically the concept of how to do it.

  • jhill16jhill16 USMember ✭✭

    @ajohar Im getting an error that says a view doesn't have a method for Add

  • ajoharajohar INMember ✭✭

    My bad, it should be AddView.

Sign In or Register to comment.