Can any aircraft adjust the wing dihedral in flight?
There was one, and it did it to increase directional stability at supersonic speed. I am talking of the North American XB-70, of course. There were three benefits to this configuration:


Improved directional stability. Without the effect of the folded-down wingtips, the XB-70 would had lost all directional stability upwards of Mach 2. The wingtips folded down to 64.5° anhedral (or is it -64.5° dihedral?) which effectively made them into ventral fins. This answer explains how a ventral fin is especially helpful at supersonic speed, because it works in the compressed air below the aircraft.
Less shifting of the aerodynamic center. Since the transition to supersonic flight will shift the aerodynamic center back, folding the wing tips down reduces lift in the aft section of the wing, thus reducing the aftward shift.
Better capture of the compressed lower wing flow for lift creation, which is called a waverider. This increases the pressure on the lower side of the wing at high supersonic speed and allows to fly with a reduced angle of attack, thus reducing drag.




XB-70 landing with wingtips straight (picture source)



XB-70 in flight with wingtips down (picture source)

The XB-70 is also one of only a few types where every aircraft ever built had different dihedral: AV-1, the first prototype, had 0° while AV-2, the second prototype, had 5° dihedral over the whole wing to improve yaw and roll stability. Only the dihedral of the outer panels could be adjusted in flight, however. According to this source (PDF!) they were the largest moveable aerodynamic device ever used on an airplane.

Other cases of variable dihedral were less intentional, though, and there was really no advantage to it:



Like on many Navy aircraft, the wings of the F-4 could be folded for stowage. If the mechanism was not locked, the wings would fold up. The F-4 was even powerful enough to be flyable this way. When only one side folded up, the F-4 would crash, however.