Android. Kotlin. Не отображаются заголовки элементов Menu

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:icon="@drawable/ic_btn_action_menu"
        app:showAsAction="ifRoom"
        android:title="">
        <menu>
            <item android:id="@+id/settings_menu_change_name"
                android:title="@string/settings_menu_change_name"
                android:icon="@drawable/ic_btn_action_menu_change_name"
                app:showAsAction="never"/>

            <item android:id="@+id/settings_menu_exit"
                android:title="@string/settings_menu_exit"
                android:icon="@drawable/ic_btn_action_menu_exit"
                app:showAsAction="never"/>

        </menu>
    </item>
</menu>

Fragment.kt

package com.example.telegram.ui.fragments

import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import androidx.fragment.app.Fragment
import com.example.telegram.R

private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"

class SettingsFragment : BaseFragment(R.layout.fragment_settings) {

    private var param1: String? = null
    private var param2: String? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {
            param1 = it.getString(ARG_PARAM1)
            param2 = it.getString(ARG_PARAM2)
        }
    }

    override fun onResume() {
        super.onResume()
        setHasOptionsMenu(true)
    }

    override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
        activity?.menuInflater?.inflate(R.menu.settings_action_menu, menu)
    }

    companion object {
        @JvmStatic
        fun newInstance(param1: String, param2: String) =
            SettingsFragment().apply {
                arguments = Bundle().apply {
                    putString(ARG_PARAM1, param1)
                    putString(ARG_PARAM2, param2)
                }
            }
    }
}

Результат:

введите сюда описание изображения


Ответы (0 шт):