用点击底部导航条事件,显示相应页面PagerView,点击事件发生了,页面却没有转跳,这是怎么回事,本人用的是管理器
public void Show(int index){
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
//返回字体颜色
resetTextView();
if (currentIndex == index) {
return;
}
switch (index) {
case 0:
if (buFragment == null) {
buFragment = new BuFragment();
transaction.add(R.id.pager_main, buFragment);
}
transaction.show(buFragment);
break;
case 1:
if (mfFragment == null) {
mfFragment = new MfFragment();
transaction.add(R.id.pager_main, mfFragment);
}
transaction.show(mfFragment);
break;
case 2:
if(amFragment==null) {
amFragment = new AmFragment();
transaction.add(R.id.pager_main, amFragment);
}
transaction.show(amFragment);
break;
case 3:
if (moreFragment == null) {
moreFragment = new MoreFragment();
transaction.add(R.id.pager_main, moreFragment);
}
transaction.show(moreFragment);
break;
}
switch(currentIndex){
case 0:
if(buFragment!=null)transaction.hide(buFragment);
break;
case 1:if(mfFragment!=null)transaction.hide(mfFragment);
break;
case 2:if(amFragment!=null)transaction.hide(amFragment);
break;
case 3:if(moreFragment!=null)transaction.hide(moreFragment);
break;
}
transaction.commit();
currentIndex=index;
}
}
这是报错信息
E/GED: Failed to get GED Log Buf, err(0)
W/MALI: gles_context_new:222: [MALI]ctx init(phase:7) takes more than 20ms here. Elapse time(us): 34345
E/libPowerStretch: LUCID_1 (1490142889342) PowerXtend Common Architecture Integration Call - libinput.so
E/libPowerStretch: LUCID_1 (1490142912864) PowerXtend identified package name: com.example.administrator.myhealth. Application is not handled by PowerXtend
Application terminated.

public void Show(int index){
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
//返回字体颜色
resetTextView();
if (currentIndex == index) {
return;
}
switch (index) {
case 0:
if (buFragment == null) {
buFragment = new BuFragment();
transaction.add(R.id.pager_main, buFragment);
}
transaction.show(buFragment);
break;
case 1:
if (mfFragment == null) {
mfFragment = new MfFragment();
transaction.add(R.id.pager_main, mfFragment);
}
transaction.show(mfFragment);
break;
case 2:
if(amFragment==null) {
amFragment = new AmFragment();
transaction.add(R.id.pager_main, amFragment);
}
transaction.show(amFragment);
break;
case 3:
if (moreFragment == null) {
moreFragment = new MoreFragment();
transaction.add(R.id.pager_main, moreFragment);
}
transaction.show(moreFragment);
break;
}
switch(currentIndex){
case 0:
if(buFragment!=null)transaction.hide(buFragment);
break;
case 1:if(mfFragment!=null)transaction.hide(mfFragment);
break;
case 2:if(amFragment!=null)transaction.hide(amFragment);
break;
case 3:if(moreFragment!=null)transaction.hide(moreFragment);
break;
}
transaction.commit();
currentIndex=index;
}
}
这是报错信息
E/GED: Failed to get GED Log Buf, err(0)
W/MALI: gles_context_new:222: [MALI]ctx init(phase:7) takes more than 20ms here. Elapse time(us): 34345
E/libPowerStretch: LUCID_1 (1490142889342) PowerXtend Common Architecture Integration Call - libinput.so
E/libPowerStretch: LUCID_1 (1490142912864) PowerXtend identified package name: com.example.administrator.myhealth. Application is not handled by PowerXtend
Application terminated.
