I know may be duplicate but i am not finding any solution for that. Actually, i want to show menu with text and icon inside fragment which having a toolbar, i have just add one line in fragment to show menu is
    class JustTry : Fragment(){
    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return inflater?.inflate(R.layout.fragment_try, container, false)
    }
    override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        var mToolbar = view!!.findViewById<Toolbar>(R.id.toolbar)
        mToolbar.inflateMenu(R.menu.dashboard_menu)
    }
}
I got this output from this code.
here is my menu xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/nav_home"
        android:icon="@mipmap/ic_launcher"
        android:title="Home" />
    <item
        android:id="@+id/nav_messages"
        android:icon="@mipmap/ic_launcher"
        android:title="Messages" />
</menu>
My question is why i am not getting Icon in Message and Home items even i am adding android:icon tag. Any help will be appreciated.

 
     
    