修改屏幕分辨率研究了一下,不过也没有研究透彻,希望知道:
下拉框选中分辨率改变:
spinner01.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String command = "wm size\t"+spinner01.getSelectedItem();//改变分辨率的命令:wm size 1082x720
Log.i("data",command);Process process = null; DataOutputStream os = null; try { process = Runtime.getRuntime().exec("su");// the phone must be root,it can exctue the adb command os = new DataOutputStream(process.getOutputStream()); os.writeBytes(command + "\n"); os.writeBytes("exit\n"); os.flush(); } catch (Exception e) { e.printStackTrace(); }} @Override public void onNothingSelected(AdapterView<?> parent) { }});
需要注意的就是1024x720,是x而不是*!
这样可以改变屏幕分辨率,但不能达到自己预想的效果,因为没有更改屏幕密度,需要先更改密度才能更改分辨率。希望知道的前辈指导。