1. An electronic device for gesture-based key input, comprising: a camera; a display configured to display a virtual keyboard; and a controller configured to: set a three-dimensional (3-D) input region, corresponding to the displayed virtual keyboard, according to a typing mode selected from among a single-hand typing mode and a double-hand typing mode, recognize a gesture for the input region, detected through the camera, and obtain a key input according to the recognized gesture.