I would like use a FloatingActionButton on my application, I read this : https://guides.codepath.com/android/Floating-Action-Buttons#google-s-official-support-library but wh
Add these dependencies into your gradle file. This may solve the problem in some cases.
dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
...
}
For those using AndroidX Dependency
Along with changing dependencies, XML must also be changed.
from
<android.support.design.widget.CoordinatorLayout
to
<androidx.coordinatorlayout.widget.CoordinatorLayout
I had the same error. Just change the project parent theme to
<style name="Base.AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
or any other Theme.AppCompat*
Please put compile 'com.android.support:design:23.0.1'
inside your project build.gradle file
Just use this line in FloatingActionButton (app
instead of android
):
app:backgroundTint="@color/colorAccent"
(supports Android API 7 to 22+)
Android.Support.V7.App.AppCompatActivity
Your used style has to be derived from a Theme.AppCompat.*
style. So your Resources\values\styles.xml
should look like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="YourAppTheme" parent="Theme.AppCompat">
<item name="colorPrimaryDark">#AB000D</item>
<item name="colorPrimary">#E53935</item>
<item name="colorAccent">#00B8D4</item>
</style>
<!-- other styles... -->
</resources>
Also make sure you actually use the theme in your AndroidManifest.xml
<application android:theme="@style/YourAppTheme"></application>