I understand what materialism is, but idealism - not so much. I know however they are opposing views, and would like to know what are the differences.
Analogies would be greatly appreciated.
It's hard to give a once-and-for-all answer to this question, because what exactly materialism and idealism amount to depends largely on the historical era you have in mind.
That said, here's one way to cash out these notions. Materialism is the view that material objects exist. Idealism is the view that every object either is, or depends for its existence upon, mental entities.
Note that, as stated, these aren't opposing views, for it could be that material objects are either identical to or depend upon mental entities for their existence. (Edit: upon reflection I decided to redact the bit about Berkeley.)
However, anti-materialism sits pretty naturally with idealism, because if you deny that material objects exist you'll need some account of what objects are, and it looks like idealism offers a neat answer to that.
I can offer only one angle on a many-sided question. I largely agree with the first answer. Then in my own terms :
This typically means that only ideas exist - ideas in the, or a, subject's mind. Hence Bishop Berkeley's claim that all that exist are minds or spirits and their ideas. Point to a so-called object in the external world, say a chair, and the answer from an idealist is likely to be that he chair is just a collection or complex of ideas : we say it is brown, but that means just that we have a perception of brown. We say that it is solid, but that only means that we will experience the idea - a feeling - of resistance if we touch it.
Berkeley needs careful handling. On his account ideas cannot be the effects produced in us by objects in the external world. Then how do they originate ? Among the minds or spirits is God. God produces in us all our ideas. What's more, God controls all minds or spirits simultaneously and creates the aggregates of ideas that we call chairs, the sun, and other constants and continuants in what we (or 'the vulgar') take to be the external world. Some ideas exhibit a regularity in our experience which causes us to regard them as Laws of Nature.
Though the term 'idealism' does not derive from Berkeley - Leibniz had already used it and Berkeley doesn't use it so far as I know - Berkeley's use of ideas as fundamental (along with the minds that have them) suggests the origin of the term in the notion of ideas. Idealism is idea-ism and only 'idealism' for ease of language.
Various possibilities here but most, or quite, likely the view that all that exist are physical things. Everything that exists is purely physical and can be described in physical terms where the physical is whatever occupies a space/ time region.
This is an extreme form of materialism. Materialism can also refer to the view that them material has primacy, that it is fundamental and everything else dependent on or derivative from it. (Thanks to ttphns for reminding me of the distinction.)
This gives the broad contrast and I hope it helps.