简单自定义组件解决如上问题:
public class ExpandListView extends ListView { public ExpandListView(Context context, AttributeSet attrs) { super(context, attrs); } /** * 设置不滚动 */ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } }
时间: 2024-09-30 13:03:55