1、ScrollView can host only one direct child
ScrollView只能有一个子控件,子控件外面再套一层LinearLayout,注意只能是Linearlayout,布局中不能出现RelativeLayout。
2、嵌套ListView布局显示不全
主要是重写onMeasure方法,具体参考文章
public class ScrollListView extends ListView {
public ScrollListView (Context context) {
super(context);
}
public ScrollListView (Context context, AttributeSet attrs) {
super(context, attrs);
}
public ScrollListView (Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2
, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}