Dynamic screening of ions in solids