InflateException with FloatingActionButton from Official Design Library
com.android.support:appcompat-v7:21+
added support for tinting widgets on devices running pre android 5.1 (API Level 21). To make use of it make sure you extend or set the AppCompat
Theme and use app:backgroundTint
instead of android:backgroundTint
.
Example:
<android.support.design.widget.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/icon"
app:backgroundTint="@color/accent"
app:borderWidth="0dp" />
Android Studio: Error inflating class android.support.design.widget.FloatingActionButton
For any person still having this problem after febuary 2019, if you are using androidx or the new material libraries, This problem is happening because Google changed the naming format of the libraries using androidx.. you can check this official mapping https://developer.android.com/jetpack/androidx/migrate/artifact-mappings
and search for your library to see what the new name is, now that Google is in androidx
In your case, your library "android.support.design.widget.FloatingActionButton" in your xml file, is now called as using com.google.android.material.floatingactionbutton.FloatingActionButton
android.support.design.button.MaterialButton throws InflateException
Ensure that the App Theme style is inherited from Theme.MaterialComponents
Example:
<style name="XXXXXAppTheme" parent="@style/Theme.MaterialComponents.Light.DarkActionBar">
Error inflating class android.support.design.widget.CoordinatorLayout
Please change it into AppCompatActivity if you use Activity. Probably it becomes the error when it is Activity.
Related Topics
How to Get the Position Selected in a Recyclerview
Check Whether Activity Is Active
How to Handle Multiple Countdown Timers in Listview
Not Able Disable Home Button on Specific Android Devices
Expand/Collapse Lollipop Toolbar Animation (Telegram App)
Android Share Intent for a Bitmap - Is It Possible Not to Save It Prior Sharing
When to Use a Content Provider
Jar Mismatch! Fix Your Dependencies
How to Get App Market Version Information from Google Play Store
Viewpager Detect When User Is Trying to Swipe Out of Bounds
How to Create Android Spinner Without Down Triangle on the Right Side of the Widget
Differencebetween @Id and @+Id
How to Automate the Android Sdk Installation
Android - Share on Facebook, Twitter, Mail, Ecc
Any Way to Link to the Android Notification Settings for My App