We study Anderson localization in a disordered potential combined with
an inhomogeneous trap. We show that the spectrum displays both localized
and extended states, which coexist at intermediate energies. In the
region of coexistence, we find that the extended states result from
confinement by the trap and are weakly affected by the disorder.
Conversely, the localized states correspond to eigenstates of the
disordered potential, which are only affected by the trap via an
inhomogeneous energy shift. These results are relevant to disordered
quantum gases and we propose a realistic scheme to observe the
coexistence of localized and extended states in these systems.