ExpandableListView在ScrollView顯示不全的
解決辦法有兩種
第一種是在ScrollView的控件中添加
android:fillViewport="true" 這屬性 但是添加這屬性的不好的地方就是不能滑動了
第二種解決辦法就是自定義view
/**
* Created by Xk
* on 2019/5/31
* 860618071
*/
public class SuperExpandableListView extends ExpandableListView {
public SuperExpandableListView(Context context) {
super(context);
}
public SuperExpandableListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SuperExpandableListView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
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);
}
}