您的位置:首页 > 移动开发 > Android开发

android改变屏幕分辨率

2016-03-22 10:47 483 查看
修改屏幕分辨率研究了一下,不过也没有研究透彻,希望知道:

下拉框选中分辨率改变:

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而不是*!

这样可以改变屏幕分辨率,但不能达到自己预想的效果,因为没有更改屏幕密度,需要先更改密度才能更改分辨率。希望知道的前辈指导。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: