How to programmatically set style attribute in a view

前端 未结 11 2016
北恋
北恋 2020-11-22 06:38

I\'m getting a view from the XML with the code below:

Button view = (Button) LayoutInflater.from(this).inflate(R.layout.section_button, null);
11条回答
  •  抹茶落季
    2020-11-22 06:54

    You can do style attributes like so:

    Button myButton = new Button(this, null,android.R.attr.buttonBarButtonStyle);
    

    in place of:

提交回复
热议问题