/**
* 判断是不是小米的miui系统
* 返回空表示不是miui,是则返回版本
* */
public static String getSystemProperty() {
String propName="ro.miui.ui.version.name";
String line=null;
BufferedReader input = null;
try {
Process p = Runtime.getRuntime().exec("getprop " + propName);
input = new BufferedReader(
new InputStreamReader(p.getInputStream()), 1024);
line = input.readLine();
input.close();
} catch (IOException ex) {
ex.toString();
return null;
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.toString();
}
}
}
return line;
}
使用WindowManager的addview时尤其注意!!!
// 小米系统的权限和其他手机不一样,需要区别设置view的权限
if ("".equals(FileUtils.getSystemProperty())
|| FileUtils.getSystemProperty() == null) {
wmParams.type = android.view.WindowManager.LayoutParams.TYPE_PHONE;
} else {
wmParams.type = android.view.WindowManager.LayoutParams.TYPE_TOAST;
}
判断当前手机是不是小米系统以及小米系统版本获取
最新推荐文章于 2023-08-04 14:49:20 发布