53.11 Displaying Icon Tab Items
The last step in this tutorial is to replace the text based tabs with icons. Achieve this by modifying the onCreate() method in the MainActivity.kt file to assign some built-in drawable icons to the tab items:
private fun configureTabLayout() {
tab_layout.addTab(tab_layout.newTab().setIcon(
android.R.drawable.ic_dialog_email))
tab_layout.addTab(tab_layout.newTab().setIcon(
android.R.drawable.ic_dialog_dialer))
tab_layout.addTab(tab_layout.newTab().setIcon(
android.R.drawable.ic_dialog_map))
tab_layout.addTab(tab_layout.newTab().setIcon(
android.R.drawable...