仔细分析代码,发现问题出在代码: getWindowManager().getDefaultDisplay().getMetrics(dm) Initialize a DisplayMetrics object from this display's data. dm = getResources().getDisplayMetrics() Return the current display metrics that are in effect for this resource object. The returned object should be treated as read-only.