Android - How to programmatically set the button style in a Linearlayout?

前端 未结 6 1825
无人共我
无人共我 2020-12-25 11:22

I am programmatically creating a LinearLayout for an AlertDialog with some buttons.

I WANT to do this:



        
6条回答
  •  情深已故
    2020-12-25 11:36

    This worked for me:

    int buttonStyle = R.style.your_button_style;
    Button button = new Button(new ContextThemeWrapper(context, buttonStyle), null, buttonStyle)
    

提交回复
热议问题