解决listview 在scrollview 显示不全

2017-03-23  本文已影响0人  RuanJH
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ListView;

/** 
 * 重写Listview 解决在scrollview现实不全
 * 
 * @author rjh
 *
 */
public class MyListView extends ListView {  
      
    public MyListView(Context context) {  
        // TODO Auto-generated method stub  
        super(context);  
    }  
  
    public MyListView(Context context, AttributeSet attrs) {  
        // TODO Auto-generated method stub  
        super(context, attrs);  
    }  
  
    public MyListView(Context context, AttributeSet attrs, int defStyle) {  
        // TODO Auto-generated method stub  
        super(context, attrs, defStyle);  
    }  
  
    @Override  
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {  
        // TODO Auto-generated method stub  
        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,  
                MeasureSpec.AT_MOST);  
        super.onMeasure(widthMeasureSpec, expandSpec);  
    }  
}
上一篇下一篇

猜你喜欢

热点阅读