对话框需要加入的元素很多,需要用写定xml的方式实现,方法为在onCreateDialog里LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = li.inflate(R.layout.dialog1, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(v);
dialog = builder.create();现在还需要对dialog本身做一些设定,比如去掉标题栏,设置背景等等
在onCreateDialog里加入dialog=new Dialog(this.R.style.dialog);不能生效在xml里面设置android:background也没有效果求指点

解决方案 »

  1.   


    是builder的setView方法吗?
      

  2.   


    可是对话框上方还是占的有位置,尽管是透明的,这样就使的message区域不能居中
      

  3.   

    你是想用dialog还是AlertDialog????
    AlertDialog有setCustomTitle,可以设置title风格,你要是不想要title,传null应该就行了。
    setView设置自己的布局,背景设置直接放在对应的xml里就行了。
    或者你对
    View v = li.inflate(R.layout.dialog1, null);
    这样生成的View直接操作setBackground设置,也行的。
      

  4.   

    应该在AndroidManifest,相应的Activity里面声明android:theme="@...自己的文件名、style名"