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
You need to add in your app's build gradle the following support library.
compile 'com.android.support:design:23.0.1'
that was last year, now the latest version is
compile 'com.android.support:design:27.0.2'
needed both:
extend AppCompatActivity instead of FragmentActivity
public class MyActivity extends AppCompatActivity
parent of used style (/res/values/styles.xml)
<style name="MyStyle" parent="Theme.AppCompat">
additionally:
define colors in styles.xml
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
Please change it into AppCompatActivity if you use Activity. Probably it becomes the error when it is Activity.
For me, I came across this error when using a mix of androidx
and android.support.v7
libraries.
See my solution for that version of this error here: https://stackoverflow.com/a/52490825/1762493
You have to include the support libraries.
For those using AndroidX Dependency. In your xml files make sure all your
android.support.???
nodes inside CoordinatorLayout's (like included ActionBars) are also replaced with
androidx.??? (or com.google.android.???)
ones .