Ilbranteloth
Explorer
Can you stick your head out from a rock (or creature) you are hiding behind and attack with advantage?
I would say no. Hiding does not grant advantage—being unseen does—and you are no longer unseen as soon as you pop your head out.
I would say 'Yes, but...'
If you are hidden before coming out to make your attack, I'd say you get advantage.
If you are simply unseen, then I'd say you don't get advantage.
My reasoning is this - The exact location of a Hidden creature is unknown. So the target isn't necessarily looking in the right place for you, and doesn't notice you until it's too late.
If you're not Hidden, then your position is known. In which case the target is expecting that you might be attacking from that position, and will see you when you pop out. Thus your advantage is eliminated.
So then we're back to the hiding in the obvious or same location. I like Mike Mearle's answer in the halfling sniper thread in which additional attempts at hiding are made with disadvantage. If you still manage to Hide (with a capital 'H'), even with disadvantage, then you retain your advantage when attacking.
This still allows characters to attempt heroic actions without breaking the game (or rules).
Randy