Open ZZombiee opened 5 years ago
public class YNavigator extends CommonNavigator {
private int mIndex = -1;
public YNavigator(Context context) {
super(context);
}
@Override
public void onPageSelected(int position) {
if (mIndex != position)
onPageSelectChanged(mIndex, position);
super.onPageSelected(position);
mIndex = position;
}
public void onPageSelectChanged(int position, int goal) {
if (getAdapter() != null) {
if (getPagerIndicator() != null && getPagerIndicator() instanceof YLinePageIndicator) {
((YLinePageIndicator) getPagerIndicator()).onPageSelectChanged(position, goal);
}
}
}
}
@Override
public IPagerIndicator getIndicator(Context context) {
YLinePageIndicator indicator = new YLinePageIndicator(context) {
@Override
public void onPageSelectChanged(int position, int goal) {
L.d("YLinePageIndicator", "onPageSelectChanged:" + position + "," + goal);
((TabFragment) tabAdapter.getItem(goal)).getDetail();
}
@Override
public void onPageSelected(int position) {
L.d("YLinePageIndicator", "onPageSelected:" + position + "");
}
};
indicator.setLineHeight(AppUtils.auto_height_px(getResources().getDimension(R
.dimen.p1)));
indicator.setColors(context.getResources().getColor(R.color.btn_orange));
return indicator;
}
这样就好了
我也有这个问题但是我是要在onSelected 的时候 reset 我的某一部分数据 但是现在 弹出键盘就给我初始化了 卧槽 我蒙蔽了
我的列表里菜单可以弹出键盘 只要弹出键盘,就会触发CommonNavigator的onLayout,然后间接触发onPageSelected,而我又在这个回调里设置了不同Fragment的刷新操作 现象就变成了弹出键盘就触发刷新,产生了较为严重的Bug 我觉得至少需要加一个监听,onPageSelectChanged