Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android CrollListener上的ExpandableGridView不工作_Android - Fatal编程技术网

Android CrollListener上的ExpandableGridView不工作

Android CrollListener上的ExpandableGridView不工作,android,Android,我已经尝试了几乎所有与此相关的答案和解决方案,但它对我不起作用。帮帮我 这是我的ExpandableGridView的代码。请通过它 这是我的ExpnaTableView:- public class ExpandableHeightGridView extends GridView { boolean expanded = false; public ExpandableHeightGridView(Context context) { super(context); } public Ex

我已经尝试了几乎所有与此相关的答案和解决方案,但它对我不起作用。帮帮我

这是我的ExpandableGridView的代码。请通过它

这是我的ExpnaTableView:-

public class ExpandableHeightGridView extends GridView {
boolean expanded = false;
public ExpandableHeightGridView(Context context) {
super(context);
}

public ExpandableHeightGridView(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public ExpandableHeightGridView(Context context, AttributeSet attrs,
                                int defStyle) {
    super(context, attrs, defStyle);
}

public boolean isExpanded() {
    return expanded;
}

@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    // HACK! TAKE THAT ANDROID!
if (isExpanded()) {
        // Calculate entire height by providing a very large height hint.
        // View.MEASURED_SIZE_MASK represents the largest height possible.
int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK,
MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);

ViewGroup.LayoutParams params = getLayoutParams();
params.height = getMeasuredHeight();
} else {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}

public void setExpanded(boolean expanded) {
    this.expanded = expanded;
}
信息技术的发展和实施:-

mGridView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {

}

@Override
public void onScroll(AbsListView view, int firstVisibleItem, int                   
visibleItemCount, int totalItemCount) {
    int currentFirstVisPos = view.getFirstVisiblePosition();
System.out.println("UUUUUUUUU "+myLastVisiblePos);
myLastVisiblePos = currentFirstVisPos;
}
});

我已经添加了代码,您可以检查它。