Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Criei um menu

Inflei um menu em ListaAlunos, mas o menu não aparece, nem o nome da aplicação.

meu manifest. -----------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.hsergio.agenda">

    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="aaaaaaaaa"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths"/>
        </provider>

        <activity
            android:name=".ListaAlunosActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>

        <activity
            android:name=".FormularioActivity">
        </activity>
    </application>

</manifest>

ACIONANDO MENU

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu_lista_alunos, menu);
        return super.onCreateOptionsMenu(menu);
        //return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.menu_enviar_notas :
                Toast.makeText(this,"Enviando notas..", Toast.LENGTH_LONG);
                break;
        }
        return super.onOptionsItemSelected(item);
    }

Menu_lista_alunos.


<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.example.hsergio.agenda.ListaAlunosActivity">
    <item
        android:id="@+id/menu_enviar_notas"
        android:orderInCategory="100"
        android:title="Enviar notas"
        android:icon="@drawable/ic_menu_upload"
        app:showAsAction="always"
        />
</menu>

OBS.: No formulario de EDIÇÃO, o menu aparece.....

2 respostas
solução!

basta remover a linha

android:theme="@style/AppTheme.NoActionBar"

no Manifest

Boa Henrique, matou a dúvida :D

O que precisar estamos a disposição