想显示dialog时,如果想显示的是自定义布局的dialog,并使用如下方式,则会报错requestFeature() must be called before adding content

AlertDialog dlg = new AlertDialog.Builder(this).create();               
dlg.setContentView(R.layout.dialog_layout);  
dlg.show(); 

修改方法是,改变一下顺序,先dlg.show();然后再进行setContentView(R.layout.dialog_layout);就没问题了。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2021-12-29
  • 2021-06-02
相关资源
相似解决方案