Theoretical profiles of He II lines in OB stars with an expanding, spherically symmetric atmosphere are computed. The extended atmospheric model is formed by a classical photosphere, characterized by the effective temperature and the surface gravity, and superimposed layers that have different velocity and temperature structure. We solve rigorously the radiative transfer equation, simultaneously with the statistical equilibrium equations for multilevel atoms, by making use of Feautrier's method in the comoving frame. We discuss the influence on the He II lines of the hydrodynamic and thermodynamic structure of the atmosphere, paying special attention to those configurations that give rise to emission lines. The main conclusions of our work can be summarized as follows:
1. The shape of the profiles is determined by the velocity gradient at the base of the wind whenever a positive temperature gradient occurs.
2. In O-type stars, the emission-line intensity depends quite sensitively on log g, in agreement with the Walborn luminosity criterion.
3. In addition, we are able to produce emission and absorption profiles that are in qualitative agreement with those observed in O and B stars.
4. We also confirm the previous Cidale & Ringuelet and Venero, Cidale, & Ringuelet results that showed that a warm, extended, and rapidly expanding atmosphere is sufficient to give rise to emission components in the line profiles.