序
昨晚美股中途再次熔断 。今天早上看我的支付宝的理财 ,收益 -7.24元 。
页面效果就不贴出来了 。想象一个效果滑动的 View 加上一个可展开收起滑动的 View 。
1. 首先是页面显示不全问题
设置此行代码即可
android:fillViewport="true"
2. 滑动冲突问题
主要有两种 ,一个是根本滑不动 ,一个是只能滑动 ExpandableListView 。
需要重写 ExpandableListView 。
public class NestedExpandableListView extends ExpandableListView {
public NestedExpandableListView(Context context) {
super(context);
}
public NestedExpandableListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NestedExpandableListView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec(
Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom);
ViewGroup.LayoutParams params = getLayoutParams(); // 存在一个问题 ,如果是全部收起的话 ,就会导致页面空白
params.height = getMeasuredHeight();
}
}
PS :如果存在空白 ,可去 XML 布局里面调整 ExpandableListView 的相关位置属性 。