In android how to set navigation drawer header image and name programmatically in class file?

前端 未结 16 919
半阙折子戏
半阙折子戏 2020-12-04 07:53

In android studio 1.4.1, I have created new Navigation Drawer Project which is default.My issue is in this project there is nav_header_main.xml file which is for navigation

16条回答
  •  庸人自扰
    2020-12-04 08:29

    Also you can use Kotlinx features

    val hView = nav_view.getHeaderView(0)
    hView.textViewName.text = "lorem ipsum"
    hView.imageView.setImageResource(R.drawable.ic_menu_gallery)
    

提交回复
热议问题