myListView.setMinimumWidth(50);
    myListView.setMinimumHeight(50);
看看、

解决方案 »

  1.   

    在代码中设置view对应的LayoutParams对象的宽度,例如在线性布局中设置button的宽度:
    private static LinearLayout ll;ll = new LinearLayout(this.getBaseContext());
    ll.setOrientation(LinearLayout.VERTICAL);    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lp.topMargin = 5;
    lp.leftMargin = 5;
    lp.width = 100;
    ll.addView(btn, lp);