如题.我使用的是new AlertDialog.Builder(UIView.this).setMessage("History cleard!").show();
弹出来的对话框的宽度很长, 我该怎么设置一下呢

解决方案 »

  1.   

      我也不知道, 不过, 看看在里面嵌入个view吧, 指定view的大小, 估计就成了。
      

  2.   

    我刚做android不久, 能请问下你说的这种方法怎么实现吗?有什么方法可以嵌入一个view上去呢?
      

  3.   

      要有自我学习精神, 呵呵。 给个思路,就应该能查到。LayoutInflater mInflater = (LayoutInflater) getContext()   
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);   
    View view = mInflater.inflate(R.layout.recordlayout, null);   
    LinearLayout layout = (LinearLayout) view   
            .findViewById(R.id.id_recordlayout);   
    for (int i = 0; i < fieldName.length; i++) {   
        String name = fieldName[i];   
        if ("_id".equals(name))   
            continue;   
        TextView tv = new TextView(getContext());   
        tv.setText(fieldName[i]);   
        EditText edit = new EditText(getContext());   
        layout.addView(tv);   
        layout.addView(edit);   
    }   
      
    AlertDialog.Builder dialog = new AlertDialog.Builder(getContext());   
    dialog.setTitle(R.string.add_a_record);   
    dialog.setView(view);   
      
    dialog.setPositiveButton(R.string.ok,   
            new DialogInterface.OnClickListener() {   
                public void onClick(DialogInterface dialog, int which) {   
      
                }   
            });   
    dialog.setNegativeButton(R.string.cancel,   
            new DialogInterface.OnClickListener() {   
                public void onClick(DialogInterface dialog, int which) {   
      
                }   
            });   
    dialog.show();  <?xml version="1.0" encoding="utf-8"?>  
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"  
        android:layout_width="fill_parent" android:layout_height="fill_parent">  
        <LinearLayout android:id="@+id/id_recordlayout"  
            android:layout_width="fill_parent" android:layout_height="fill_parent"  
            android:orientation="vertical" android:padding="10dip"></LinearLayout>  
    </ScrollView>  
      

  4.   

    支持#4楼说的,
    自己定义一个Layout,不过在该layout中定义宽度和高度属性,往往不起作用。
    在#4楼的代码中添加红色部分。
    LayoutInflater mInflater = (LayoutInflater) getContext()   
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);   
    View view = mInflater.inflate(R.layout.recordlayout, null);   
    view.setMinimumHeight(200);
    view.setMinimumWidth(500);

    LinearLayout layout = (LinearLayout) view   
            .findViewById(R.id.id_recordlayout);