ScrollView嵌套ExpandableListView,ExpandableListView的写法

来源:互联网 发布:谭浩强c语言第四版答案 编辑:程序博客网 时间:2024/05/01 22:19
public class MyExpandableListView extends ExpandableListView {    public MyExpandableListView(Context context) {        super(context);    }    public MyExpandableListView(Context context, AttributeSet attrs) {        super(context, attrs);    }    public MyExpandableListView(Context context, AttributeSet attrs, int defStyle) {        super(context, attrs, defStyle);    }    /**通过重新dispatchTouchEvent方法来禁止滑动*/    @Override    public boolean dispatchTouchEvent(MotionEvent ev) {        // TODO Auto-generated method stub        if (ev.getAction() == MotionEvent.ACTION_MOVE) {            return true;/**只要简单改下这里就可以禁止Gridview进行滑动*/        }        return super.dispatchTouchEvent(ev);    }    @Override    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {        int expandSpec = MeasureSpec.makeMeasureSpec(                Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);        super.onMeasure(widthMeasureSpec, expandSpec);    }}

0 0
原创粉丝点击