32

How do I get rid of the email icon on the bottom of the phone? It is on all of them and it shouldn't be there.enter image description here

user3577756
  • 643
  • 1
  • 9
  • 13
  • It is a Floating Action Button, it could be either in a XML layout or added programmically - I think, and I could be wrong, that all new 'blank activity' templates in Android Studio 1.4 are like this now where a floating action button is already coded by default. – Mark Oct 19 '15 at 01:40
  • You should use a smaller image in your question next time instead of a full resolution image, just so everyone doesn't have to scroll all the way down to see the icon and can get to the answer quicker. – The Unknown Dev Dec 31 '16 at 20:47

5 Answers5

63

Go to activity_main.xml and delete this portion:

<android.support.design.widget.FloatingActionButton 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" />

And then go to MainActivity.java and delete this portion

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });

That's it. You should now see that the icon disappeared.

Irfan
  • 646
  • 1
  • 6
  • 2
10

I guess you are looking for it in content_main.xml and that is why you don't see it. Check activity_main.xml and delete it from there.

Quanlong
  • 24,028
  • 16
  • 69
  • 79
Rados
  • 481
  • 4
  • 17
5

This is what your looking to remove

 <android.support.design.widget.FloatingActionButton 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" />

its not in the activity_main.xml its inside the app_bar_main.xml

2
<android.support.design.widget.FloatingActionButton
    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" />

Delete this code from app_bar_main.xml

PaRth Vaghela
  • 31
  • 1
  • 5
  • 5
    Please post only if you have additional information or value ad than other answers. Other answers already specified this part – Raju Apr 13 '16 at 01:51
0

Look for src attribute in your layout file of the Activity and change it.

<android.support.design.widget.FloatingActionButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_email"
            app:elevation="4dp"
            ... />
Sharjeel
  • 15,588
  • 14
  • 58
  • 89