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);
}
});
}
答案 0 :(得分:1)
在您的 build.gradle
中添加以下内容implementation 'com.android.support:design:27.1.1'
答案 1 :(得分:0)
implementation 'com.google.android.material:material:1.2.0'
<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"/>
https://developer.android.com/guide/topics/ui/floating-action-button