yasser
yasser

Reputation: 43

import android.support.design.widget.FloatingActionButton;

import android.support.design.widget.FloatingActionButton;

give me eror here and here 
 // Setup FAB to open EditorActivity
        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(CatalogActivity.this, EditorActivity.class);
                startActivity(intent);
            }
        });
    }

enter image description here

Upvotes: 0

Views: 12175

Answers (2)

Haseeb
Haseeb

Reputation: 2101

Add the following in your build.gradle

implementation 'com.google.android.material:material:1.2.0'

Add the following in your Code

<com.google.android.material.floatingactionbutton.FloatingActionButton

    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="end|bottom"/> 

Documentation

https://developer.android.com/guide/topics/ui/floating-action-button

Upvotes: 3

prashant17
prashant17

Reputation: 1550

Add the following in your build.gradle

implementation 'com.android.support:design:27.1.1'

Upvotes: 2

Related Questions