Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro no FloatingActionButton - Android Studio 4.2.1

Não compila quando add o FloatingActionButton

erro: Caused by: android.view.InflateException: Binary XML file line #28: Binary XML file line #28: Error inflating class com.google.android.material.floatingactionbutton.FloatingActionButton Caused by: android.view.InflateException: Binary XML file line #28: Error inflating class com.google.android.material.floatingactionbutton.FloatingActionButton Caused by: java.lang.reflect.InvocationTargetException

 dependencies {

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.3.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}

<ListView
    android:id="@+id/activity_main_lista_de_alunos"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</ListView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/activity_main_fab_novo_aluno"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:fabSize="mini"
    android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true"
    android:layout_marginEnd="26dp"
    android:layout_marginBottom="26dp"
    android:clickable="true"
    android:src="@drawable/ic_action_novo_aluno"
    android:tint="#D14848"
    app:backgroundTint="#850D0D"
    tools:srcCompat="@tools:sample/backgrounds/scenic" />

Android Studio 4.2.1 JDK11

1 resposta
solução!

Eu adicionei o activity android:theme="@style/Theme.AppCompat.Light" e funcionou

<application>
    <activity android:name=".MainActivity"    android:theme="@style/Theme.AppCompat.Light">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>