It is a little troublesome to remove it. The easiest way is to simply create a new project by unchecking the "Create Activity" checkbox in the wizard and then adding a new class to src.
But if you really want to remove v7 material from an existing project, here is one way to delete it, the action bar and fragments:
- Remove the android.libary.reference line from project.properties, ignoring the warning at the top.
- Change the MainActivity type from ActionBarActivity to just Activity.
- Remove import v7 and v4.Fragment.
- Remove the integer "if (savedInstanceState)" statement from MainActivity.
- Remove the PlaceholderFragment class from MainActivity.
- Replace the contents of the activty_main.xml file with the contents of the fragment_main.mxl file or your own layout.
- If you have not used your own layout, remove the tools: context attribute / value from Activity_main.xml.
- Edit each of the three styles.xml files (under the * values) and change the parent style of the AppBaseTheme style to "android: Theme.Light" (or your choice).
- Change the /main.mxl menu and remove the application: showAsAction attribute / value.
- Organize the import and clean your project.
Just to be clear: this is not what you really want to do for a real application, but more than what you can do if you just create a demo or proof of concept.
Edit:
In the future, you can add an additional template that creates an Activity without appcompat_v7. You can get it on CommonsWare here . It's nice to write about it here .
source share