Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mNavigationView = (NavigationView) findViewById(R.id.navigation_view);
- headerView = mNavigationView.inflateHeaderView(R.layout.bp_header);
- googele_plus = (ImageButton) headerView.findViewById(R.id.google_p);
- facebook = (ImageButton) headerViewfindViewById(R.id.fb);
- mNavigationView = (NavigationView) findViewById(R.id.navigation_view);
- View headerView = mNavigationView.getHeaderView(0)
- googele_plus = (ImageButton) headerView.findViewById(R.id.google_p);
- facebook = (ImageButton) headerView.findViewById(R.id.fb);
- You may have header layout in xml and also you are adding header from java like
- headerView = mNavigationView.inflateHeaderView(R.layout.bp_header);
- So just remove above line from java and add it through the xml
- You can add following in your xml
- <include
- android:id="@+id/header"
- layout="@layout/navigation_header" />
- and then in java create ref like below
- googele_plus = (ImageButton) findViewById(R.id.google_p);
- facebook = (ImageButton) findViewById(R.id.fb);
- Clean and Build the project and then run
- headerView = mNavigationView.inflateHeaderView(R.layout.bp_header);
- View header = LayoutInflater.from(this).inflate(R.layout.bp_header, null);
- mNavigationView.addHeaderView(header);
- googele_plus = (ImageButton) header.findViewById(R.id.google_p);
Add Comment
Please, Sign In to add comment