Problem with navigation drawer

1

I'm doing a project with a Navigation drawer and when loading the MAIN Activity xml it shows an image that I have in the background but when loading any fragment it shows me the content of that fragment but with the Main Activity image in the background and not I want it to be seen, Alguin could help me with that little problem.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);




    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
        this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    navigationView.setItemIconTintList(null);


}
    
asked by Jorge Miguel Marrero gonzalez 24.12.2018 в 22:39
source

2 answers

1

one way is by adding this property to each layout of the fragments:

 android:background="?android:colorBackground"
    
answered by 25.12.2018 / 16:41
source
0

Hello to put image or color to each fragment or activy xml that you have just do this:

    
answered by 02.01.2019 в 16:48