他在課堂上心不在焉。

He had his head in the clouds in class.

Source: Tatoeba

Sentence Composition