gpt4 book ai didi

java - 错误: method setCurrentItemInternal in class

转载 作者:行者123 更新时间:2023-12-02 00:15:25 26 4
gpt4 key购买 nike

当我将代码更新为 androidx 时,出现此错误

"error: method setCurrentItemInternal in class ViewPager cannot be applied to given types;
required: int,boolean,boolean,int
found: int,boolean,boolean
reason: actual and formal argument lists differ in length"

代码:

    public class NonRestoringViewPager extends ViewPager implements setCurrentItemInternal {
private boolean isRestoring = false;
private final boolean useDefaultImplementation;

public NonRestoringViewPager(Context context) {
super(context);
useDefaultImplementation =
!QuranUtils.isDualPagesInLandscape(context, QuranScreenInfo.getOrMakeInstance(context));
}

public NonRestoringViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
useDefaultImplementation =
!QuranUtils.isDualPagesInLandscape(context, QuranScreenInfo.getOrMakeInstance(context));
}

@Override
public void setCurrentItemInternal(int item, boolean smoothScroll, boolean always) {
if (useDefaultImplementation || !isRestoring) {
super.setCurrentItemInternal(item, smoothScroll, always);
}
}

@Override
public void setCurrentItemInternal(int item, boolean smoothScroll, boolean always, int velocity) {
if (useDefaultImplementation || !isRestoring) {
super.setCurrentItemInternal(item, smoothScroll, always, velocity);
}
}

@Override
public void onRestoreInstanceState(Parcelable state) {
isRestoring = true;
super.onRestoreInstanceState(state);
isRestoring = false;
}

@Override
public boolean onTouchEvent(MotionEvent ev) {
try {
return super.onTouchEvent(ev);
} catch (IllegalArgumentException e) {
return false;
}
}
}

最佳答案

androidx 依赖项中的函数签名可能已更改。因此,请检查函数签名并传递所需的参数值。

关于java - 错误: method setCurrentItemInternal in class,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58090206/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com