How to remove automatic items from an Activity

Asked

Viewed 158 times

0

In Android Studio, when it comes to creating an Activity, the IDE already places some items inside it, such as that circle with an envelope inside (image). How do I remove it after created the Activity?

inserir a descrição da imagem aqui

  • 2

    Have you asked several questions about how to eliminate "things" that the Android Studio generates when creating a new project, if you do not want to use it choose Empty Activity by creating it.

  • Yes, but there is already a lot of things created. I wanted to see how I remove these things so as not to have rework.

  • When choosing the type of Activity choose an empty Activity, if I am not mistaken it would be Empty Activity, it will create only with onCreate and the layout initialization. Or you can delete the method that in this case I think is the floattingbutton. But the first way I think better.

  • It is the floatingbutton yes, Vinicius. inside the activity_main.xml. Thank you!

  • Don’t forget to mark the answer if it helped you.

  • Vinicius, you sent a comment, not an answer to the question. Send the answer I can vote for here ;)

Show 1 more comment

1 answer

0


When you create a new Activity Android Studio tries to facilitate its work by leaving several things created. Like the case of Toolbar and Floatingbutton. If you do not want an Activity with Floatingbutton select Blankactivity. Blankactivity comes empty only with the minimum necessary to use that Activity, i.e., in Blankactivity the IDE adds it in Manifest as Activity, creates Java inheriting from Appcompact with onCreate() method, creates 2 XML layout being an activity_layout.xml and content_layout.xml.

The 2 XML are created to facilitate code organization. The content as name already says will have the main content of Activity, lists, buttons, etc. and in Activity layout is inserted objects "patterns", which every page has, such as Floatingbutton, Toolbar, and content_layout.

If you want to create an Activity without Floatingbutton select Blankactivity, if you select Empity aide you understand that you will need Floatingbutton and add in XML and already create the Java code to manipulate it.

The same idea is for other Activity, for example if you want to work with Maps select the map template, as the IDE will prepare everything you need to manipulate the map.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.