ListView在代码中动态设置高度


//让ListView高度最大 完全显示 
public void setHeight(){  
    int height = 0;  
    int count = adapter.getCount();  
    for(int i=0;i){  
        View temp = adapter.getView(i,null,listview);  
        temp.measure(0,0);  
        height += temp.getMeasuredHeight();  
    }  
    LayoutParams params = this.listview.getLayoutParams();  
    params.width = LayoutParams.FILL_PARENT;  
    params.height = height;
}  

你可能感兴趣的:(Android,数据显示)