Android fragments 为什么当我点击一个片段时,它会被放置在我的内容中的一个图像上? 我想我们需要更多关于你正在尝试做什么和它实际在做什么的细节。问题是,当我选择菜单中的一项时,它会出现在我的主要内容上 @SuppressWarnings("StatementWithEmpty

Android fragments 为什么当我点击一个片段时,它会被放置在我的内容中的一个图像上? 我想我们需要更多关于你正在尝试做什么和它实际在做什么的细节。问题是,当我选择菜单中的一项时,它会出现在我的主要内容上 @SuppressWarnings("StatementWithEmpty,android-fragments,Android Fragments,为什么当我点击一个片段时,它会被放置在我的内容中的一个图像上? 我想我们需要更多关于你正在尝试做什么和它实际在做什么的细节。问题是,当我选择菜单中的一项时,它会出现在我的主要内容上 @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) {' // Handle navigation view item clicks here.

为什么当我点击一个片段时,它会被放置在我的内容中的一个图像上?
我想我们需要更多关于你正在尝试做什么和它实际在做什么的细节。问题是,当我选择菜单中的一项时,它会出现在我的主要内容上
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {'
    // Handle navigation view item clicks here.
    int id = item.getItemId();
    Fragment fragment = null;

    if (id == com.example.edwincastao_pc.app_gym.R.id.nav_search) {
        fragment = new Search_Custom();'
    } else if (id == com.example.edwincastao_pc.app_gym.R.id.nav_register) {
        fragment = new Log_In();'
    } else if (id == com.example.edwincastao_pc.app_gym.R.id.nav_delete) {
    } else if (id == com.example.edwincastao_pc.app_gym.R.id.nav_manage) {
    } else if (id == com.example.edwincastao_pc.app_gym.R.id.nav_info) {
    } else if (id == com.example.edwincastao_pc.app_gym.R.id.nav_close) {
    }
    if (fragment != null) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        fragmentManager.beginTransaction().replace(R.id.contenido, fragment).commit();
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(com.example.edwincastao_pc.app_gym.R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}