How to remove Floating Action Button Android Studio Blank Activity Template

Posted on : Fri, 16th Oct 15 12:52 pm GMT

If you create an Android App project in Android Studio and you select a Black Activity Template you will get FAB : Floating Action Button incorporated with the Activity, if you do not want it then remove the following code blocks.

1. Remove the following code from onCreate class. Language : Java
FloatingActionButton fab = (FloatingActionButton) findViewById(;
    fab.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();

2. Remove the following code from drawables -> layout -> activity_main.xml

activity_main.xml Language : Java
    < android:id="@+id/fab"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_email" />
FAB icon removed


FAB icon removed

We are operating with limited resources due to COVID-19 - Stay Safe!

We stands in support of racial equality!

Follow us : Facebook - Twitter