Java Code Examples for android.support.design.widget.NavigationView#addHeaderView()

The following examples show how to use android.support.design.widget.NavigationView#addHeaderView() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From AndroidSkinAnimator with MIT License 5 votes vote down vote up
private void initNavigationView(NavigationView navigationView) {
    View headerView = getLayoutInflater().inflate(R.layout.main_header_layout, null, false);
    navigationView.addHeaderView(headerView);
    mMainHeaderBinding = DataBindingUtil.bind(headerView);
    mMainHeaderBinding.setListener(this);
    initSkinName();
}
 
Example 2
Source File: BaseActivityWithDrawer.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
protected void registerDrawer() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    final 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){
        @Override
        public void onDrawerClosed(View drawerView) {
            super.onDrawerClosed(drawerView);
            if(iDrawerClosedCallBack != null){
                iDrawerClosedCallBack.onDrawerClosed();
            }
        }
    };
    drawer.setDrawerListener(toggle);
    toggle.syncState();
    navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    tintNavView(ThemeController.getCurrentColor().mainColor);
    headerLayout = (FrameLayout) LayoutInflater.from(this).inflate(R.layout.nav_header_main, null);
    ImageView imageView=(ImageView)headerLayout.findViewById(R.id.nav_header_back);
    imageView.setImageDrawable(ImageProcessor.zoomImageMin(
            ContextCompat.getDrawable(this, R.drawable.navigation_header)
            , getResources().getDisplayMetrics().widthPixels
            , getResources().getDisplayMetrics().widthPixels));
    navigationView.addHeaderView(headerLayout);
}
 
Example 3
Source File: HNewsNavigationDrawerActivity.java    From yahnac with Apache License 2.0 4 votes vote down vote up
protected void refreshHeader() {
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    View header = LayoutInflater.from(this).inflate(R.layout.design_navigation_item_header, null, true);
    navigationView.addHeaderView(header);
}