Android中获取手机的分辨率案例

public class GetScreenSize extends Activity {  
    @Override  
    public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.main);  
        DisplayMetrics displaysMetrics = new DisplayMetrics();  
        getWindowManager().getDefaultDisplay().getMetrics(displaysMetrics);  
        String showSize = "手机屏幕分辨率:" + displaysMetrics.widthPixels + "*" +displaysMetrics.heightPixels ;  
        System.out.println(showSize);  
    }  
}  

你可能感兴趣的:(Android中获取手机的分辨率案例)