当前位置: 代码迷 >> Android >> AlertDialog样式有关问题
  详细解决方案

AlertDialog样式有关问题

热度:14   发布时间:2016-05-01 14:14:41.0
AlertDialog样式问题
请问各位高手,我想修改alertdialog的颜色要怎么弄?


------解决方案--------------------
自己定义style, 然后把theme通过 builder的第二个参数传递过去就可以了
------解决方案--------------------
http://www.eoeandroid.com/tag.php?name=AlertDialog&page=1
借鉴..

自定义alertdialog 想改什么就改什么~
------解决方案--------------------
Java code
    public void showDialog_Layout(Context context){                      LayoutInflater inflater = LayoutInflater.from(this);            // 绑定 布局           View view = inflater.inflate(R.layout.dialog, null);                  //到绑定布局内的 子控件                  final EditText edtInput=(EditText)view.findViewById(R.id.edtInput);                      AlertDialog.Builder builder = new AlertDialog.Builder(context);                      builder.setCancelable(false);//设置为false,按返回键不能退出。默认为true。              builder.setIcon(R.drawable.hong);              builder.setTitle("Title");              builder.setView(view);              builder.setPositiveButton("确认",new DialogInterface.OnClickListener() {                          public void onClick(DialogInterface dialog, int whichButton) {                              setTitle(edtInput.getText());                          }              });              builder.setNegativeButton("取消",                      new DialogInterface.OnClickListener() {                          public void onClick(DialogInterface dialog, int whichButton) {                             finish();                        }              });              builder.show();      }
------解决方案--------------------
自定义一个布局,改一下布局里的背景,试一下
  相关解决方案