安卓上的导航抽屉滞后
2022-09-01 19:41:31
我遇到了问题 导航抽屉 ,它太慢了,我正在寻找的解决方案是先关闭抽屉,然后显示活动,但它不起作用,当然我错过了一些东西。
private class DrawerItemClickListener implements ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int posicao, long id) {
setLastPosition(posicao);
setFragmentList(lastPosition);
layoutDrawer.closeDrawer(linearDrawer);
}
}
private OnClickListener userOnClick = new OnClickListener() {
@Override
public void onClick(View v) {
layoutDrawer.closeDrawer(linearDrawer);
}
};
private void setFragmentList(int posicao) {
FragmentManager fragmentManager = getSupportFragmentManager();
Fragment fragment = new FragmentViagens();
switch (posicao) {
case 0:
fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
break;
case 1:
fragmentManager.beginTransaction().replace(R.id.content_frame, new FragmentPedidos()).commit();
break;
case 2:
fragmentManager.beginTransaction().replace(R.id.content_frame, new FragmentClientes()).commit();
break;
}
navigationAdapter.setChecked(posicao, true);
setTitleFragments(lastPosition);
navigationAdapter.resetarCheck();
layoutDrawer.closeDrawer(linearDrawer);
}