A NaI(Tl) detector array called DALI2 (Detector Array for Low Intensity radiation 2) has been constructed for in-beam $gamma$-ray spectroscopy experiments with fast radioactive isotope (RI) beams. It consists typically of 186 NaI(Tl) scintillators covering polar angles from $sim$15$^{circ}$ to $sim$160$^{circ}$ with an average angular resolution of 6$^{circ}$ in full width at half maximum. Its high granularity (good angular resolution) enables Doppler-shift corrections that result in, for example, 10% energy resolution and 20% full-energy photopeak efficiency for 1-MeV $gamma$ rays emitted from fast-moving nuclei (velocities of $v/c simeq 0.6$). DALI2 has been employed successfully in numerous experiments using fast RI beams with velocities of $v/c = 0.3 - 0.6$ provided by the RIKEN RI Beam Factory.