sAa*_*aNu 16 android custom-titlebar android-alertdialog
我如何在alertDialog中包含自定义标题栏?我知道android sdk提供了setCustomTitle方法,但它不起作用
编辑:
AlertDialog alert = new AlertDialog.Builder(this).setTitle("Test").setMessage("hello").show();
View view=alert.getLayoutInflater().inflate(R.layout.titlebar, null);
alert.setCustomTitle(view);
Run Code Online (Sandbox Code Playgroud)
但上面的代码不起作用
注意:
我不是在寻找自定义对话框,而是只想使其标题布局自定义.如下所示
Vik*_*ram 55
你不应该在第一行使用.show方法,使用下面的代码:
AlertDialog.Builder alert = new AlertDialog.Builder(this);
LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(R.layout.titlebar, null);
alert.setCustomTitle(view);
alert.setMessage("helo");
alert.show();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29311 次 |
| 最近记录: |