0
嗨,有一個系統知道JVM在哪個設備上運行。這是要知道它是Android的手機還是平板電腦?是否有系統屬性知道該設備是移動或平板電腦或桌面在Android?
嗨,有一個系統知道JVM在哪個設備上運行。這是要知道它是Android的手機還是平板電腦?是否有系統屬性知道該設備是移動或平板電腦或桌面在Android?
或者您可以使用DisplayMetric屬性(寬度,高度)來查找設備是否爲選項卡/移動設備。
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int width = metrics.widthPixels;
int height = metrics.heightPixels;
if (SharedCode.width > 1023 || SharedCode.height > 1023){
//code for big screen (like tablet)
}else{
//code for small screen (like smartphone)
}
也檢查:http://stackoverflow.com/questions/11330363/how-to-detect-device-is-android-phone-or-android-tablet – Caner
抱歉。我在你指定的其他帖子上找到答案。謝謝。 – Murray9654