How can I create an animation with a transparent background in the Material viewport?
There are three ways to render images or animations with a transparent background.

Using OpenGL render :

Make sure that you set the Alpha mode to Transparent in the Render > OpenGL Render Options > Alpha Mode which is located in the info header.



Using Blender Render :

Make sure that you have set the Alpha to Transparent in the Shading option under the Render tab in the Properties panel.



Using Cycles render :

Make sure that you the Transparency ticked on in the Film option under the Render tab.